WordPress.org

Ready to get started?Download WordPress

Forums

[Plugin: Regenerate Thumbnails] Stopped working, error msg (19 posts)

  1. shaneholden
    Member
    Posted 2 years ago #

    Regenerate thumbnails was working perfectly for me, but without any reason that I can find, it just stopped. I've added no more plugins, functions, etc., just stopped one night and started the next. I've been doing it in batches through the dropdown menu in the Media section

    The error I keep getting now is:

    (ID 1493) failed to resize. The error message was: The originally uploaded image file cannot be found at...

    Any idea what's going on?

  2. shaneholden
    Member
    Posted 2 years ago #

    I'm still getting

    Debugging Information
    
    Total Images: 1
    Images Resized: 0
    Resize Failures: 1
    
    "dsc_1565" (ID 1359) failed to resize. The error message was: The originally uploaded image file cannot be found at /home/shane/public_html/wp-content/uploads/2008/12/dsc_1565.jpg

    for images from 02/2009 and older. Every one back to that point worked perfectly. Any idea what the issue may be?

  3. Does /wp-content/uploads/2008/12/dsc_1565.jpg exist?

  4. shaneholden
    Member
    Posted 2 years ago #

    Yessir. I've tried it on many others past that and none work. Anything newer (uploaded after that point) work just fine.

  5. Are you any good with PHP? If so, are you willing to help me debug?

    I'm curious what the output of var_dump( get_attached_file( 1359 ) ) is.

  6. shaneholden
    Member
    Posted 2 years ago #

    I wish I could say I was good with it. If it's something fairly simple that you could walk me through, I'd be more than willing to do it. Or, if it's something that's not so easy, I'd be up for giving you access to debug it. Just let me know

  7. Try adding this to the top of your theme's functions.php file:

    add_action( 'admin_init', 'viper_debug' );
    function viper_debug() {
    var_dump( get_attached_file( 1359 ) );
    exit();
    }

    Then visit your admin area, copy/paste the little bit of output (if it's showing your admin area, then it's not working), and then remove the code to get your admin area back.

  8. shaneholden
    Member
    Posted 2 years ago #

    Here's the output

    string(63) "/home/shane/public_html/wp-content/uploads/2008/12/dsc_1565.jpg"

  9. Okay, so that's working correctly. Looking back to the error message that's rather obvious though. Whoops. *facepalm*

    Did you change hosting at some point or anything? I'm thinking that perhaps the absolute path isn't correct.

    Try this:

    add_action( 'admin_init', 'viper_debug' );
    function viper_debug() {
    var_dump( __FILE__ );
    exit();
    }
  10. shaneholden
    Member
    Posted 2 years ago #

    I have changed hosting before, but as far as I can remember, it was before the month & year that get this error.

    This new code gives me:

    string(70) "/home/shanehol/public_html/wp-content/themes/shaneholden/functions.php"

    I appreciate your time!

  11. shaneholden
    Member
    Posted 2 years ago #

    Hi Alex, just wanted to check and see if you've had a chance or had any luck with this?

    Thanks so much!

  12. ve39
    Member
    Posted 1 year ago #

    have exact same issue !

  13. Steve Borsch
    Member
    Posted 1 year ago #

    Alex,

    Having *exactly* the same issue after upgrading to WP 3.4 last night on one of my mission-critical sites!

    Thumbnails mysteriously vanished on many of my posts and pages (and all galleries are pretty much broken) and regenerating them causes errors to begin at image 204 out of 2000+.

    Didn't change hosting. Didn't add plugins. Stumped.

  14. rilwis
    Member
    Posted 1 year ago #

    Hi Alex, I have the exact problem. I'm not sure it's because of WP 3.4 (I don't remember when this problem happened). Maybe it's the problem of WP itself.

    Here's a screenshot of an image in the Media Library that shows the error as well: http://t.co/Duc4deIY

  15. wesg
    Member
    Posted 1 year ago #

    I'm having the same issue with media thumbnails, but I'm doubtful it's related to the plugin. Since updating to WP3.4 most of my older media is not showing up and trying this plugin results in the same error as above.

    I'm guessing something changed from the database retrieval. If you need any help debugging, I'd be happy to help!

  16. wesg
    Member
    Posted 1 year ago #

    I'd like to add that I just just tried the above var_dump command on specific attachments and the images that disappeared return a blank string.

  17. wesg
    Member
    Posted 1 year ago #

    I discovered why the icons aren't showing up. It appears that previous versions of WP ignored the _wp_attached_file meta key, where the newest version requires it for looking up the attachment data. The attachments that weren't displaying were missing this key.

    Below is PHP code for descending through the post database, verifying the presence of this key (and file) and updating accordingly. I'll leave it to you to add it to your theme (I added it to a submenu for database tools). After processing, it will display the number of updates, skipped posts and errors.

    // descend through the database
    $updated = 0;
    $skipped = 0;
    $error = 0;
    $upload_dir = wp_upload_dir();
    
    $sql = sprintf("select * from %s where post_type = 'attachment'", $wpdb->posts);
    $all_attachments = $wpdb->get_results($sql);
    
    foreach ($all_attachments as $attachment) {
    	// get the meta value
    	$meta = get_post_meta($attachment->ID, "_wp_attachment_metadata", true);
    	$file = $meta['file'];
    
    	// verify that the file exists
    	$file_path = $upload_dir['basedir'] . '/' . $file;
    	if (!file_exists($file_path)) {
    		$error++;
    	}
    	else {
    		// add the meta value, which returns false if it already exists
    		$adding_meta = add_post_meta($attachment->ID, '_wp_attached_file', $file, true);
    		if ($adding_meta)
    			$updated++;
    		else
    			$skipped++;
    	}
    }
    echo '<div id="message" class="updated"><p>' . sprintf("%d attachments were updated, %d were skipped and %d had errors.", $updated, $skipped, $error) . '</p></div>';
  18. Gergster
    Member
    Posted 1 year ago #

    Thanks wesg this is exactly the answer I was looking for, could you explain how to add it to a theme?

  19. Cosmin
    Member
    Posted 1 year ago #

    Hey guys, having the same problem with this plugin...

    Tried the code from wesg, this is what I get:

    0 attachments were updated, 67 were skipped and 1 had errors.

    Any other ideas?

    EDIT: a solution can be found here (last post).

Topic Closed

This topic has been closed to new replies.

About this Topic