Add image sizes to WordPress

Here’s how to add more image sizes to WordPress.

This goes in your theme’s functions.php file:

if ( function_exists( 'add_image_size' ) ) {
  // Non cropped tall thumb with 3:4 ratio
  add_image_size( 'tall_thumbnail', 80, 107 );
 
  // Small 30x30 cropped thumb
  add_image_size( 'tiny_thumbnail', 30, 30, true );
}

Here’s what the parameters do:

$name
Image size identifier.
$width
Image width in pixels. Default 0.
$height
Image height in pixels. Default 0.
$crop

Image cropping behavior. If false, the image will be scaled (default). If true, the image will be cropped to the specified dimensions from the center. If an array, the image will be cropped using the array to specify the crop location. Array values must be in the format: array( x_crop_position, y_crop_position ) where:

  • x_crop_position accepts: 'left', 'center', or 'right'.

  • y_crop_position accepts: 'top', 'center', or 'bottom'.

Default value: false