How to Resize WordPress Thumbnail and Add multiple size

How to Resize WordPress Thumbnail and Add multiple size?
WordPress Provide three image sizes which you can customize easily. You can access them through your WordPress admin dashboard under Settings > Media. You can set the dimensions of the basic image sizes that the WordPress Media Library makes available. Size generated when you upload a new image through the Media Library.

thumbnail-resize-wordpress

In above picture you can see that three type of image size. you can adjust these size according to your requirement. You can also prevent wordpress default media image sizes eaisly.

Create Multiple Image Thumbnail Size

If you need to add more Thumbnail size or want to cut images according to you then you have to do some coding in your theme function.php file.

Before we start, make sure that your theme supports thumbnails function. To do this just make sure the the following line of code is in your functions.php file.

Now next step to create image size according to your requirement for this you have to put below line in function file.

The add_image_size(); function has 4 parameters. $name is the name that you want to call your image with. $width is the width you want the image to crop to in pixels. $height is the height you want the image to crop to in pixels. $crop is a true or false parameter. If set to true the image will crop itself automatically.

After create the image thumbnail size, now time to display it in your website. put below code where you want to use this size of thumbnail for example in you custom post type or blog post thumbnail.

When you add these new sizes, they’re not going to magically appear in the drop-down menu list of options in the Media Library when you go to embed an image. To make that happen you have to add some more code to your functions.php file that looks like this (again, it’s a good idea to back up your working functions.php file before making the changes.

For more better understand you can also see function on WordPress site page – Add Image Size and Set Post Thumbnail Size

Guide for Cropping custom Thumbnail

When you’re setting the thumbnail sizes you have a choice of how you want your thumbnails cropped. Perhaps you want to fit into a specific part of your page. Perhaps you want squares or very wide but narrow thumbnails. Or maybe you want to make sure that the entire image always shows up. So here’s a guide to the different crop modes for thumbnails available in WordPress.

The Soft Crop in WordPress is the same as what’s commonly known as a Fit crop and is what we’d normally think of as a pure resize. It’s proportional, so the entire area of the image is retained.

The hard crop will fill a box of whatever dimensions you specify and cut out any other parts of the image that don’t fit in that box. If you want to create square thumbnails from rectangular images, make the width and height the same.

You can also crop thumbnail like top left side, top center or bottom left etc.few example code are below.

Resizing Existing Thumbnails

Your old thumbnails are still showing up in their old sizes. That’s because re-sizing happens as part of the image upload process. So the new sizes will apply to all new images you upload. But chances are you’ve got hundreds, perhaps thousands, of thumbnails you want to re-size to your new dimensions. Regenerate Thumbnails plugin do changes all your old thumbnails size according to new size, just install that plugin and regenerate thats it.

Enabling Additional Image Sizes for your Post using plugin

If you want to resize post thumbnail without doing coding in your theme, just install Post Thumbnail Editor and Simple Image Sizes. both plugin have great function and easy to use.