clarifynl/responsive-pics

Resize quirks when setting a max height

Closed this issue · 5 comments

When a desired height is entered this only seems to be used when the width of the original image is larger than the calculated width of a resized image.

You'd expect it to work differently; the newly calculated image to be restricted by the desired width and desired height (just like in background-size: contain)

Hi @abel-sch, I did some tests and I can't seem to reproduce this issue anymore with the latest version 1.4.0.
Could you try and verify if your max height does get applied correctly now?
Thanks!

I don't see any changes. Here's a screenshot that might clarify what happens:
Screenshot 2022-01-13 at 10 27 41

The top row uses:
{!! ResponsivePics::get_picture($slide->image, 'xs-12 250, sm-12 250, md-12 350', 'm-lightbox-carousel__image') !!}
All images should fit within the 12 cols so there's no reason for some images to be smaller.

The bottom row uses:
{!! ResponsivePics::get_picture($slide->image, 'xs:0 250, sm:0 250, md:0 350', 'm-lightbox-carousel__image') !!}
Which does work for this purpose but doesn't restrain the width.

Could you delete the resized images that are being displayed?
It could be it won't regenerate the correct image since the filename (with the wrong size) already exists.

Re-adding the images sadly gives the same result (I double checked, Responsive Pics re-processed them)

Could you verify if the latest 1.4.3 release, fixed your issue?

The issue was, if the requested width or height was larger then the image dimensions, it would preserve the image aspect ratio and apply it to the max width and max height, which could result in a smaller max height in this case. I verified it locally and it works for me:
rp_max_width_max_height