I've an image-oriented project. Images comes in different dimention and orientation. Based on following rules i'm generating smaller images:
add_image_size('big_xxl', 4500, 9999); // 4500 x flex_height
add_image_size('big_xl', 3300, 9999); // 3300 x flex_height
add_image_size('big', 2100, 9999); // 2100 x flex_height
add_image_size('medium', 1250, 9999); // 1250 x flex_height
Considering that add_image_size( string $name, int $width, int $height, bool|array $crop = false )
I need to find a way to generate images with FLEXIBLE_width but FIXED_height, for same image key (string $name
).
Explanation:
Current code supports only landscape-images. I need to achieve portrait images, that based on FIXED_height value.
I see an approach to declare second set of image sizes for portrait images (big_xxl_portrait
, big_xl_portrait
and so on, where int $width
will be '9999'
) ,and define what to display on front-end based on the if($image_is_portrait){...}else{...}
logic.
Asking if it's possible to generate image of the same string $name
, wich size will depends on original picture orientation, since having unesessary copies of those images will dramaticaly increase server costs (doulbe storage value reuired) and it'll be a file-mess in total.
Update: Editing question in order to bump-up an issue-tread