I am have set an add_image_size
function that is often larger in only one dimension than the uploaded image. This results in an image that has one dimension cropped and one dimension that remains un-cropped resulting in an image that loses it’s proportions. As a result I have a set of images that are not equally proportioned.
The desired outcome is that if the image is cropped in one dimension then it is proportionally cropped in the other dimension, meaning that I can upscale it if required with CSS.
For example, my image size is 1200 x 900. If I upload an image that is 1100 x 1467. The output is an image that is 1100 x 900. However, what I require is an image that is 1100 x 825 (the same proportion as the 1200 x 900 image size I set, but smaller as the image wasn’t large enough to fulfill this size).
Here is the function with the arguments:
add_image_size( 'landscape-huge', 1200, 600, true);
I can’t seem to find a way of doing this though – is this possible?
Because it’s wordpress default feature but u can change, go to wp-include folder then media.php and find these lines
and change to
it will work for you.