WordPress 3.5 comes with a revamped media manager with many useful options. Here is a simple tutorial on how to Regenerate Thumbnails in WordPress. Whenever an image is uploaded to WordPress post or page, it will be automatically resized into three specific sizes by default – “Large”, “Medium” and “Thumbnail”. Apart from these, additional image sizes can be defined in WordPress by using a simple function add_image_size.
Add Additional Image Sizes in WordPress.
To enable support for thumbnails in any WordPress theme, we need to add the below code to functions.php file. Most of the recently released WordPress themes comes with support for thumbnails, so incase if its already there no need to add it again.
/** Add Thumbnails Support in WordPress Theme */ add_theme_support('post-thumbnails');
Now, you need to define new thumbnail sizes by using this syntax.
<?php add_image_size( $name, $width, $height, $crop ); ?>
Here is an example of how it will be, when values are included:
/** Add Additional Image Sizes in WordPress */ add_image_size( 'small-thumb', 65, 45, true );
Add this code to functions.php file and note that from now onwards every uploaded image will be automatically resized into 4 sizes. Along with Large, Medium and Thumbnail, a new size with name “small-thumb” will also be included.
So everything is clear now and what about already uploaded attachment images? You have already uploaded some images as attachments to posts or pages, before adding new thumbnail sizes and they wont be resized. Actually, the 4th image size namely “small-thumb” is not available for all those images. So whenever “small-thumb” images are called using a function or a plugin then there will be some problem for sure.
Regenerate Thumbnails in WordPress for all Images
Here comes the handy “Regenerate Thumbnails” plugin for WordPress. It is a simple and robust plugin that helps to automatically create new thumbnail sizes for all uploaded images.
How to use Regenerate Thumbnails Plugin?
Step 2: Once done with installation, go to Tools > Regen. Thumbnails Page and you can see “Regenerate All Thumbnails” button. Before clicking on it, I recommend to backup your media files.
Step 3: The process will take some time based on the total number of images and info regarding “Resized Images” and “Failed Resizes” will be displayed.
Step 4: There is an option to “Abort” the resize process. The best part of this plugin is, you can retry “Failed Resizes” once after the process is finished.
Step 5: Voila, Thumbnails for all Uploaded images are resized successfully and you can uninstall “Regenerate Plugin” as its job is done. Check you media files folder and you can see new thumbnail image sizes.
If you want to Optimize your WordPress Blog for Google Page Speed Score, then this tutorial helps you to optimize images. If you face any issue or would like to recommend another plugin, please drop your comment here.