Regenerate Thumbnails

Hi there. May I suggest using Jetpack’s Photon module instead of this plugin? Photon will use WordPress.com’s servers to generate thumbnail images for you on-demand in whatever size is needed. This means that you don’t need to use my plugin to generate new thumbnail images when you switch themes, change thumbnail sizes, or anything else!

Don’t want to use Jetpack? That’s okay too. My plugin still works just fine.

Plugin Description:

Regenerate Thumbnails allows you to regenerate the thumbnails for all of your image attachments. This is very handy if you’ve changed any of your thumbnail dimensions (via Settings → Media) or switched to a new theme with different featured image sizes after previously uploading images.

Download:

Screenshots:

739 thoughts on “Regenerate Thumbnails

  1. Thank you a lot for the plugin.
    I have a problem with WordPress 2.7 – it shows me a message “No attachments were found. Go upload some!”

    It is strange to me.
    Anyway I found the following solution:

    instead of the line 72
    $attachments = get_children( ‘post_type=attachment&post_mime_type=image’ );
    I put
    $attachments = get_children( array( ‘post_parent’ => $post_id, ‘post_type’ => ‘attachment’, ‘orderby’ => ‘menu_order ASC, ID’, ‘order’ => ‘DESC’) );

    Now it works fine!

  2. $post_id isn’t set, so that does nothing and the order doesn’t matter either. However removing the post_mime_type may have been the real solution there. Your server may have not been marking the MIME type or something.

  3. This a fantastic plugin that exactly does what I needed! THANKS! One question: after I resized everything from 150×150 to 75×75 I noticed that all 150×150 thumbs were still in the directory of server. Would you know if there a smart and simple way to get rid of them without going through all the directories?

  4. Pingback: ?? WordPress ? Gallery ?? | Dreamcolor's Cote

  5. Not even sure if you can answer Viper, but would you have any idea why all images uploaded since Jan 2008 have ‘lost’ their thumbnail info.

    I did an export from 2.7 RC1 before upgrading to 2.7, and in the process my images got all messed up. I can’t even view the images by entering in the URL to the file?

    Images w/thumbnails (all pre-2008) can be viewed?

    Tried your plugin and it claims to have processed all images, but no dice.

  6. Viper007Bond on December 16th, 2008 at 5:15 PM wrote:

    [quote comment=”226955″]I did an export from 2.7 RC1 before upgrading to 2.7, and in the process my images got all messed up. I can’t even view the images by entering in the URL to the file?

    Export? As in the XML file? That isn’t a database export, it is a content exporter. It will not save everything in your database such as settings and such.[/quote]

    Yes, the XML export. Also did a database backup, but I’ve had issues in the past rebuilding the site using just that for some reason. (database keys got screwed up)

    That last time I went through this process, I used the XML file and didn’t have any issues with the thumbnails disappearing. And like I said, all the pre-2008 stuff is in tact?

  7. Cedric M on September 28th, 2008 at 2:47 PM wrote:

    Quick ‘n dirty patch to your plugin: avoids regenerating thumbnails already at the correct size.
    As my provider seems to have some watchdog to kill long running php processes, it enables me to hit the “reload” button until everything is done.

    Cheers
    Cédric

    @@ -88,6 +88,10 @@
    // Output progress so far to browser
    $this->flush();

    +

    // Get thumbnail max size
    +

    $thumbnail_size_w = intval(get_option(‘thumbnail_size_w’));
    +

    $thumbnail_size_h = intval(get_option(‘thumbnail_size_h’));
    +
    // Loop through each attachment
    $count = 0;
    echo ” <ol>\n”;
    @@ -100,9 +104,14 @@
    // This is a better solution than just doing set_time_limit( 0 ); in my opinion.
    set_time_limit( 30 );

    wp_update_attachment_metadata( $attachment->ID, wp_generate_attachment_metadata( $attachment->ID, $fullsizepath ) );

    echo ‘

    <li>’ . str_replace( $uploadpath, ”, $fullsizepath ) . ” processed.</code></li>\n”;
    +

    $size = image_downsize( $attachment->ID, ‘thumbnail’ );
    +

    if (($size[1] != $thumbnail_size_w) && ($size[2] != $thumbnail_size_h) && (($size[1] + 1) != $thumbnail_size_w) && (($size[2] + 1) != $thumbnail_size_h)) {
    +

    wp_update_attachment_metadata( $attachment->ID, wp_generate_attachment_metadata( $attachment->ID, $fullsizepath ) );
    +
    +

    echo ‘

    <li>’ . str_replace( $uploadpath, ”, $fullsizepath ) . ” processed.</code></li>\n”;
    +

    } else {
    +

    echo ‘

    <li>’ . str_replace( $uploadpath, ”, $fullsizepath ) . ” already at the correct size.</code></li>\n”;
    +

    }
    $count++;
    }

    Please can you upload a copy of the plugin patched?! Thanks!

  8. Question if this will work for me: all of my thumbnail files are still in the upload directories, but my database had a minor corruption issue (postmeta table was corrupt and I restored from a backup but am missing data for past four months). Will your plugin write the thumbnail info into my database so WP will once again recognize that the thumbnails are there?

  9. having wp 2.7 i have this problem trying to “Regenerate all Thumbnails”: Fatal error: Allowed memory size of 62914560 bytes exhausted (tried to allocate 85 bytes) in xxxxxx/wp-includes/functions.php on line 2901

  10. Pingback: ????? | ?? WordPress ? Gallery ??

  11. ernesto on January 30th, 2009 at 6:36 PM wrote:

    having wp 2.7 i have this problem trying to “Regenerate all Thumbnails”: Fatal error: Allowed memory size of 62914560 bytes exhausted (tried to allocate 85 bytes) in xxxxxx/wp-includes/functions.php on line 2901

    Unrelated to WordPress version. It’s trying to resize a huge image and running out of memory to do it with. Resize the original image manually to be a bit smaller in dimensions or increase your server’s PHP memory limit.

  12. Hello thank you for your plug-in is really a time saving. By the way i have a problem, i have many many posts with images and the plug-in only process them partially I don’t understand way? can u help me?

    ciao leonardo

Leave a Reply