Custom Image Sizes

Custom Image Sizes is a WordPress plugin that

  • generates the correctly-sized version of an image’s thumbnail, if it doesn’t already exist.
  • lets you specify custom sizes with a size parameter of '[width]x[height]'.

By default, WordPress doesn’t create thumbnails on the fly

In default WordPress, when you call one of the WordPress image functions such as wp_get_attachment_image_src(), wp_get_attachment_image(), or image_downsize(), if the requested size doesn’t exist, WordPress will just scale down the fullsize version of the original image. This doesn’t always look great, and it’s a waste of bandwidth.

When Custom Image Sizes is active, it will instead create the requested thumbnail size.

Default WordPress requires you to register a custom thumbnail size

You can tell WordPress to create a particularly-sized thumbnail by registering it with the core add_image_size() function. However, if you don’t want to have to do that, Custom Image Sizes lets you specify a custom size in the form of '[width]x[height]', like so:

echo wp_get_attachment_image($attachmend_id, '220x80');

/**
 * The above prints markup like
 * <img width="220" height="80" title="" alt=""
 *    class="attachment-220x80" src="http://www.example.com/path-to-file/something-220x80.jpg" />
 */

Download

Support or Questions?

Please visit my support forum or (send me an email) austin (located at) pressedcode (dot) com.

Additional Resources