Chris Wiegman

Add A New Image Size To WordPress

WordPress Logo

If you’ve been using WordPress for a while you’ve probably noticed that when you upload an image WordPress automatically creates the associated thumbnails for use throughout your site. This is great, but what happens if you want a different image size for your thumbnail or you need multiple versions of the image for different places in your site?

Here’s an easy tutorial for adding a new image size to your WordPress theme.

1.) Open your functions.php file

This file is located in your theme directory (typically wp-content/themes/[your-theme])

2.) If you want the image to be used as a post thumbnail set it accordingly

set_post_thumbnail_size( 200, 200 );

This will add a 200×200 thumbnail for all of your posts.

3.) Add other image sizes

add_image_size( ‘my-image-type’, 300, 300, true );

This will add an image size called my-image-type that is 300px x 300px and will be cropped if necessary (if you change the true to false the image will be scaled but not cropped).

4.) Update your existing images.

This is a big one. You will need to update all your existing images if you want this to work. Fortunately there is a good plug-in for this. Regenerate Thumbnails will automatically take care of updating every single image in your media library automatically so you won’t have to worry about doing it yourself (this is especially handy if you’re changing themes).