blueimp/JavaScript-Load-Image

Prevent scale up

thomasdao opened this issue · 3 comments

Hi,

Thank you for this fantastic library! I want to scale down the image with the cover: true option, but I do not want the image to scale up. Is there an option in the library that only scales down and not up? I search through almost all issues on Github but can not yet find the answers.

Thanks so much!

One possible solution I can think of is to load the image first to read the width and height and then calculate the maxWidth/maxHeight myself, but just want to check if there's faster way to do it in the library :)

Hi @thomasdao!
Yeah, unfortunately there's no specific option for that, but as you said, you can load the image first and then use the scale API with options based on the image dimensions.

Thanks @blueimp, I implemented that and it works fine :)