When you upload an image to the WordPress Media Library, WordPress creates any number of new images either scaled to or cropped from your original image. The number of images that are created are determined by the WordPress defaults, your theme's configuration, or plugins. This article focuses on the default WordPress settings and how you can add new image sizes to the media library attachment display settings.
Post thumbnails (now called featured images) were introduced in WordPress Version 2.9. A featured image is the representative image for a Post, Page, or Custom Post Type. The display of a featured image is controlled entirely by the site's theme. The theme has to specifically declare its support for featured images by using the following code in functions.php.
When you upload an image, WordPress creates three default thumbnails in addition to the original image. The default thumbnails are Thumbnail, Medium, and Large. Their sizes are:
- Thumbnail—default 150px x 150px max
- Medium resolution —default 300px x 300px max
- Large resolution—default 640px x 640px max
- Original image resolution—unmodified
The default sizes of these images can be changed through the Admin/Settings/Media page:
If you click on the screen print above, you'll see that we've redefined the Large image size to be 1024px x 1024px for this site. Also if you check "Crop thumbnail to exact dimensions (normally thumbnails are proportional)", the thumbnail images will be cropped to the exact dimensions specified whenever possible.
Add Custom Image Size
There are two steps that need to be taken to create a new image size to have it appear in the media library attachment display settings. First, you have to register a new image size. This is done with the WordPress add_image_size function. The syntax is:
The second step is to apply the new image to the image_size_names_choose filter.
Add the code below to your functions.php and you'll have a new image size in your media library attachment display settings.