WordPress.org

Ready to get started?Download WordPress

Plugin Directory

!This plugin hasn't been updated in over 2 years. It may no longer be maintained or supported and may have compatibility issues when used with more recent versions of WordPress.

Custom Image Sizes

Custom Image Sizes lets you specify exactly the size in which to display an attachment.

Usage

The typical WordPress way

  • Put add_image_size( 'my_custom_thumbnail_name', 220, 130, true ); in your theme’s functions.php file.
  • Add the code to display that attachment’s thumbnail where you want it to appear: echo wp_get_attachment_image($attachment_id, 'my_custom_thumbnail_name');
  • Unlike WordPress by itself, Custom Image Sizes will generate the thumbnail for an image, even if the image was uploaded before this add_image_size() was set.

A more direct Custom Image Sizes way

  • Call wp_get_attachment_image_src() or wp_get_attachment_image() with the desired thumbnail '[width]x[height]' dimensions, like so:
echo wp_get_attachment_image($attachment_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" />
       */

Requires: 2.9 or higher
Compatible up to: 3.1.4
Last Updated: 2010-3-12
Downloads: 4,232

Ratings

4 stars
4.9 out of 5 stars

Support

Got something to say? Need help?

Compatibility

+
=
Not enough data

0 people say it works.
0 people say it's broken.

100,1,1
100,1,1
100,1,1
100,1,1
50,2,1
100,1,1
100,1,1
0,1,0