Best practice: Append image sizes to new image size names in WordPress

If you need to access images at a number of a different sizes, the WordPress media manager actually does an amazing job of resizing one large image into all the sizes you might want. If you’re creating a bunch of custom sizes in your functions.php file assigning names like “medium_large” or “xs” can be confusing when referencing later in a theme. Recommendation: Use something like “image800.” Then you know exactly how wide the image will be. We then set the height to something crazy large like 6000. No image will be this tall so WordPress just automatically knows to always just resize proportionally by width. You don’t need to explicitly add the “false” argument because it’s the default.

1

2

3

4

5

6

7

8

9

10

11

12

add_image_size('image1200',1200,6000,false);

add_image_size('image1000',1000,6000,false);

add_image_size('image800',800,6000,false);

add_image_size('image600',600,6000,false);

add_image_size('image500',500,6000,false);

add_image_size('image400',400,6000,false);

add_image_size('image300',300,6000,false);

add_image_size('image200',200,6000,false);

Adding “true” would hard crop an image, apparently and I can see very few instance where that’d be a good idea.