Regenerate Thumbnails

Plugin Description:

Regenerate Thumbnails allows you to regenerate all thumbnail sizes for one or more images that have been uploaded to your Media Library.

This is useful for situations such as:

  • A new thumbnail size has been added and you want past uploads to have a thumbnail in that size.
  • You’ve changed the dimensions of an existing thumbnail size, for example via Settings ? Media.
  • You’ve switched to a new WordPress theme that uses featured images of a different size.



813 thoughts on “Regenerate Thumbnails

  1. Another good idea:

    I saw many posts about ‘Regenerate Thumbnails’ where it was used mainly as a fix-it tool for invalid ‘_wp_attachment_metadata’ entries in database, e.g. after moving a wordpress-site to a new location. I had exactly this problem and found your plugin when I looked for solutions.

    If a site only has a few images, the plugin (with an option like in my old sizes patch) is perfect already.

    But if a site has more images or many thumbnail-sizes, it takes quite some time.

    You could add an option which would rewrite the ‘_wp_attachment_metadata’ entry and skip the thumbnail recreation (if thumbnail already exists).

    For this you would hook the ‘intermediate_image_sizes_advanced’ filter (used in /wp-admin/includes/image.php) and manually check for existing thumbnails by the given $sizes and strip the existing ones from $sizes and adding that existing size to (global) $metadata[‘sizes’][$size].

    Then the following loop foreach ($sizes as $size => $size_data ) in image.php would only generate really missing thumbnails and still the correct $metadata would be returned by wp_generate_attachment_metadata() and could be written to db via wp_update_attachment_metadata(..)

    Hope you understand what I mean, what about that?

  2. Pingback: Strings Design Studio «

  3. Hi Alex, thanks for the great plugin! Ran in to a bit of trouble with it and I’m trying to figure out what to do. I have Amazon S3 hosting for files, but run the WordPress on a self-hosted site (Host Gator). There is a plug in called “amazon S3” that transfers files from the media library to Amazon. When I ran the Regenerate Thumbnails plugin, it resized 49 images and failed on 57 more. Each failure showed that it was looking for the file in the old path (meaning NOT on Amazon S3, but on the web server where the WordPress is running. However, when I display any of those images in the media library, it shows a path to the file at Amazon S3. When I click View, the image displays – from Amazon. So my question is, how is Regenerate Thumbnails picking up the old file location? I wonder if there is a way I can update that? Thanks!

  4. Great plugin!!! In WP 3.3 the lower bulk action selection did not work on my wordpress installation – maybe an issue..?

    Anyway used the upper one and it worker as a charm! Thanks!

  5. Haha THAT was the fastest ever!! TOTALLY cool:) What is there to say:) Hey maybe you are a bond fan as me?

    What movie… Hi, I am Jenny Flex… Of course you are Bond answers:)

    Thanks again!

  6. Hi Alex, I am experiencing a showstopper that seems so obvious, but is leaving me stumped. Regen Thumbnails is failing on all images seemingly due to it using the wrong path.

    Here’s one of the error log messages;

    “Aston Martin DBS Touchtronic” (ID 28110) failed to resize. The error message was: The originally uploaded image file cannot be found at /home/public_html/

    The image exists at ‘’, but obviously it should only be appending ‘/2010/05/DBS-touchtronic_banner.jpg’ rather than the fully-qualified domain.

    I’m using the latest WP version 3.3.1 and there are no additional plugins on the site. Any thoughts?

  7. There is one small issue in your plugin. When _wp_attached_file is filled with full path with http:// it will cause failure while resizing.
    You can easily fix it with this code (just add it right after fullsizepath definition):

    if (stripos($fullsizepath, site_url(‘wp-content/uploads/’)) !== FALSE)
    $fullsizepath = str_ireplace(site_url(‘wp-content/uploads/’),”,$fullsizepath);

  8. It’s strange behaviour of latest wordpress. Can’t really say why path include URL, but it’s a common problem — I saw several posts about it. Even here Steve Davies is complaining about it.

  9. Pingback: Working on Excerpts, Thumbnails and Teasers | Word Grrls

  10. I appears that the plugin is looking for the images in the wrong folder. Also I do not have anything specified in “media settings” – “upload files”

    When I click on “regenerate all thumbnails” I get the following error for all images:
    1.”pay_off_debt_fast” (ID 2163) failed to resize. The error message was: The originally uploaded image file cannot be found at /home6/yogadivi/public_html/creditvisionary/wp-content/uploads/public_html/creditvisionary/wp-content/uploads/2012/02/pay_off_debt_fast.png

  11. Pingback: 24 Stable WordPress Plugins For A Better Publishing Experience | Web Help 101

  12. Pingback: 24 Stable WordPress Plugins For A Better Publishing Experience |

  13. Pingback: ????? ???????????? ??????? |

    • did you ever get a solution to this? I am also getting php errors:

      function () { if (!d) { var c = arguments, g, h, i, j, k; b && (k = b, b = 0); for (g = 0, h = c.length; g < h; g++) { i = c[g], j = f.type(i), j === "array" ? e.done.apply(e, i) : j === "function" && a.push(i); } k && e.resolveWith(k[0], k[1]); } return this; }

      I had to delete some of the original larger files due to space issues. i returned them all in order to regenerate thumbnails which is when this error occurred. it seems the files are being created but all at 0kb.

      i am using WP 3.2.1.
      and the latest plugin version

  14. I’m also getting the same error as Daryl:

    Resize Failures: 1

    function () { if (c) { var a = c.length; m(arguments), i ? (k = c.length) : e && e !== !0 && (j = a, n(e[0], e[1])); } return this; }


  15. Hi there–I’m helping to get a wordpress blog going, and the blogger wants to do most of the posting with an iPad. I’ve found an app she likes and everything works well, except that none of the photos uploaded via the app show thumbnails in the WP admin Media Library.

    The cause seems to be that the uploaded images have _wp_attachment_metadata key values of “a:0:{}”, whereas images attached “correctly” via the media library interface have a lot of stuff in their _wp_attachment_metadata keys.

    Your “Regenerate Thumbnails” plugin seemed like exactly what I was looking for, except when I run it, it completely ignores the images with missing thumbnails, while regenerating thumbnails for all the other (already fine) images.

    I ran across a post ( indicating that one possible workaround might be to edit the regenerate-thumbnails.php file directly to change the method by which the plugin enumerates its list of image files, but I wanted to check here first to see if you had any other tips. I can post screenshots and code snippits if it might be helpful. Thanks!

    • I would track down the issue to the root cause — why is the app failing to properly upload images? If she’s uploading images via the app but they aren’t showing up in the Media Library properly, then something is wrong.

      I would recommend using the official WordPress app if that’s not what she’s using.

      • Thanks, Alex. I’m also contacting the app’s author (it’s Blogpress, from here: The app does indeed upload and they show up in the appropriate subdirectory under wp-content/uploads, but they don’t have auto-generated thumbnails with them (no “…150×150.jpg” or “…300×300.jpg” files like other uploaded images have). Something’s obviously not right.

        Will try to shift her to the official wordpress app, but it’s extremely crash and when you embed images in posts, it shows them as html code instead of as a picture, which is what drove me to an alternative app in the first place.


  16. Follow-up: when I select one of the non-regenerating images on the Media Library page and then choose “Regenerate Thumbnails” from the Bulk Actions drop-down, the screen changes to the Regenerate Thumbnail page and the plugin reports an error under the Debugging Information heading, saying “Failed resize: 102 is an invalid image ID.” The image ID that it lists changes depending on which image I select.

  17. Pingback: The Top 100 WordPress Plugins For Your Site

  18. Pingback: WPMU’s 100 Best Plugins | Talking Wordpress

  19. Pingback: 6 WordPress Plugins I Can’t Live Without

  20. Pingback: The Top 100 WordPress Plugins For Your Site « Mõtteid IT maailmast ja selle lähistelt

  21. Pingback: Top 100 WordPress Plugins yang Perlu Ada | Wan Rizuan Blog

  22. Hi, I’ve been using this plugin on several websites, and it is easy to use..

    but I am currently working on a new website, the plugin does not seem to have an error but it does not create any thumbnails on the uploads, in fact there is not thumbnails created other than the original image,

    just wandering if is it because of my server settings or something?

    • They are being resized proportionally. If you want them cropped, then you’ll need to enable that. You can enable that for the smallest thumbnail size at Settings -> Media. Cropping for other sizes will need to be enabled via code in your theme.

  23. Love the plugin, using it on a bunch of sites! Ran into an issue – One site got hacked and I renamed wp-content as a precaution to avoid future problems. Unfourtunately I can no longer regenerate thumbnails (which is desparately needed after moving data to a fresh WP install). I think the problem is that the plugin looks for images in wp-conent which I no longer have. How do I get the plugin to look at the new dir?

  24. Pingback: The Top 100 WordPress Plugins For Your Site | Multidots Solutions

  25. This seems like an awesome plugin and everyone can get it work, except me ;-(
    Can you tell me if I’m doing this correctly: I have images loaded in the media library, and I have ‘settings > media’ with thumbnail images set to 150 pixels wide. As a result I have thumbnail images in my posts that are 150 pixels wide. All good so far.

    When I change my ‘settings > media’ thumbnail size to 100 pixels wide, I go to ‘tools>regen thumbnails – regenerate all thumbnails’. I click the button, and get a message ‘all done!’. Then I check the posts, and all the images are exactly the same as they were – 150 pixels wide.

    Any help greatly appreciated!

    • This plugin doesn’t go through your posts and update hard-coded links to thumbnails (yet). I was playing around with some code that would do that but I never completed it. Ran into some issues but I should probably work on resolving them.

      Currently this plugin is most useful for post thumbnails and gallery thumbnails, both of which are dynamically generated rather than hard-coded in your post’s contents.

  26. It’s my experience that the Tools > Regen. Thumbs page will delete the existing files and replace them with the new settings, while the image-by-image conversion on the Media page will add the new resizes and leave the existing files in place.

    Is this difference on purpose?

    Could be a nice feature on the Regen All page to be allowed to keep the existing files if you wanted to.

    • My plugin calls the same thumbnail generation function that is called when a file is uploaded. This functions does not delete any files from your server which is important because posts contain hard-coded links to those old thumbnails.

      The only thing the thumbnail function does is generate thumbnails for all of the thumbnail sizes that are currently registered (large, medium, small, any featured post sizes, etc.) and then store that data in the meta data for the upload.

  27. hm… i set thumbnail size to 250×250 and tick for “Crop thumbnail to exact dimensions (normally thumbnails are proportional)”, but what i got is not exactly 250×250. Some image becomes 250×233 or 250×245.. where the hell those numbers come from ?

    All I want is just a fixed 250×250. Unticking make it worst, it becomes 250×180 or 250×170…


  28. Hi Alex,
    I have the following error :
    function () { if (c) { var a = c.length; m(arguments), i ? (k = c.length) : e && e !== !0 && (j = a, n(e[0], e[1])); } return this; }

    And it seems i’m not alone.
    Can i help you fix-it (giving you an access to the admin page) ?
    Best regards and thank you for your job

  29. Pingback: Our top 10 must-have and must-avoid WordPress plugins

  30. Hi Alex,

    I’m re-designing my blog & have updated from a previous version of AutoFocus
    so I tried used this plug-in as advised but I keep getting this error on any & all image i try to regenerate.

    function () { if (c) { var a = c.length; m(arguments), i ? (k = c.length) : e && e !== true && (j = a, n(e[0], e[1])); } return this; }

    Any suggestions??

      • yikes… AJAX? JSON?? jQuery???
        i don’t know what any of these terms mean, lol :/
        clearly i’m not very experienced in this

        any other suggestions,
        or any way you could explain it in lamens terms??

        i appreciate your quick response!


  31. Why my pictures don’t appear on the website? I have loaded these in the library and i use “Regenerate Thumbnails” but nothing… Help me please

  32. Hi Alex

    I am facing a problem after changing the hosting. I am not really good with PHP.
    “Seo” (ID 726) failed to resize. The error message was: The originally uploaded image file cannot be found at 2011/12/Seo.jpg”

    all images are uploaded but I still get that error

  33. Pingback: ??? 100 ????? ?????? ????

  34. Hi,
    Same problem for me. 600 images at good 4700 and made ??error in running.
    I ssh dont add, unfortunately, please tell me what must to write. thank you very much

    function (){if(c){var a=c.length;m(arguments),i?k=c.length:e&&e!==!0&&(j=a,n(e[0],e[1]))}return this}

  35. Pingback: 100 Best Wordpress Plugins by Webworx | Wordpress Web Designer

  36. Here’s a strange questions. Everything was working fine with my thumbnails and galleries. Then I decided I wanted to resize them all with the Regen plugin. Now I can’t add a thumbnail from gallery images (new or existing) but I can add any other size.

    What’s more is that if I add a thumbnail to a post in the HTML editor and then switch to the visual editor it doesn’t show up. When I click back to the HTML viewer there is a mysterious new class on the images called “ufrsgmtduachvsovggko”. That line gets added to the class every time I switch from HTML to Visual. There maybe be several on each image. Where is this coming from? Why can’t I display any thumbnails or galleries anymore?

  37. Awesome plugin!! It’s already saved me tons of time.

    Does your plugin support external images? I was able to use the Auto Featured Image plugin to set features on posts with linked images. How does your plugin handle these featured images since they are not uploaded as media?

    Thank you in advance.

Leave a Reply