How to resize and add custom image sizes in WordPress
Hello friends,
In this post you’ll learn how to resize and add custom image sizes in WordPress.
In one of the previous posts we discussed the possibility to regenerate your thumbnails in case of emergency. Such emergency can be considered: a change in the theme, requirement by a plugin or page builder solution or something else.
So now you know how to regenerate these thumbnails (click here for a reminder) and the current task at hand is to find out how you can use this feature in order to add custom image sizes in WordPress.
So the first thing to do is to go to “Settings – Media” and change the default values for each thumbnail image size. From the previous post (the one about thumbnail regeneration) you know that each variant of an uploaded image is considered a thumbnail – not just the specific name given for the smallest variant in this section of your WordPress dashboard.
Before changing the values you have to be sure what you want to achieve. You may ask yourself “why should I need a bigger large size” (for example).
There are several possible reasons:
- your design will look better;
- you are sure that the speed of your website won’t get hurt;
- you need this option for a specific sidebar plugin or custom post, etc
So now you know why you need to do this. The next thing that you have to know is the exact image size that you need. Enter its values into the respective fields for the respective image size and then click on “Save Changes”.
Now you need to regenerate your thumbnails and you are good to go.
One quick tip for the “thumbnail size” – remove the checkbox that tells WordPress to crop the thumbnail to its exact dimensions. This will allow you to have equal in size images without information loss. After you enter the values for the “thumbnail size” you need to save the settings once again and regenerate the thumbnails.
That’s great but what if I need more image sizes? The default ones are just not enough! If this is the case you’ll need to learn how to add custom image sizes in WordPress.
You are right! The default ones are not enough in most cases so you need to add custom ones. And here is exactly how to do this:
- you can edit some WordPress files and add specific code to them in order to activate additional thumbnail sizes or
- you can use one extremely user-friendly plugin that does the very same thing
Since our goal is to help beginners, I am not going to review the first option and I will directly present to you the plugin.
It is called Simple Image Sizes and it does several things:
- adds custom image sizes that are available for your posts, pages, custom content, etc
- allows you to regenerate them instantly;
What? Regeneration? But I already have a plugin for this. Why would I need the Simple Image Sizes in this case?
Well, if you want to edit the WordPress files manually, you will need to keep Regenerate Thumbnails active on your website. However if you want to use the user-friendly solution you have to deactivate it. But don’t worry! Its functionality is still present in this plugin and you can still use it (or at least the functionality is very similar).
So how to use Simple Image Sizes?
First of all deactivate and uninstall Regenerate Thumbnails (if you have it installed). Then install and activate Simple image sizes and head to “Settings – Media”. You will notice a huge change to this section.
It still provides the default sizes but now you can add new ones. You will also have access to every custom size that was added by a plugin or a theme to your WordPress website but you were not able to tweak it before. Well, now you can!
You can also delete the custom ones as well and for each custom image size you can decide whether you want to apply cropping or not. My advice is NOT to use cropping (as discussed above).
If you add a new size you can regenerate all thumbnails from the specific button at the end this section. Please save the changes first and then select the thumbnails that you want to regenerate (this is different than the old solution and much more user friendly). Then you can apply the regeneration.
Simple Image Sizes has another fascinating functionality. After you have added a new size or tweked one of the old ones, you can get the PHP code with your changes and apply it manually to the WordPress files. This is extremely handy in case you’d want to remove the plugin in the future but keep its functionality (in terms of keeping the created image sizes).
Awesome, right?
And as for the WordPress Media library – you can still regenerate the thumbnails for each individual image.
This is all you have to know about Simple Image Sizes. Will you use this plugin? Please share your thoughts in the comments below.
See you soon, friends!