collective / plone.app.imagecropping

Crops Images in Plone manually using cropper JS library
https://pypi.python.org/pypi/plone.app.imagecropping
9 stars 23 forks source link

Fix issue with scale height `65536` used as "flexible height" #144

Closed petschki closed 1 year ago

petschki commented 1 year ago

In Plone 6 there are image scales with height 65536 in order to make the height calculated flexible when scaling down to the width. This is a problem in cropping editor, because there the flag can_scale checks if width and height of scaled image is larger than the original image.

To make these scales croppable here's my solution proposal:

I'm not really happy with the hard coded pixel value though. I also thought about a checkbox in the settings to discard the maximum check for the editor and leave it up to the integrator to constrain the scales to the valid one.

feedback welcome...

see #130

MrTango commented 1 year ago

I added a test to verify the desired behavior. Currently the last assert fails, because we allow a height higher than original image, even if it is under the max value of 65536. That does not make sense.

MrTango commented 1 year ago

but also the test_create_new_hashkey_for_cropped_images is still failing and i think not without reason.

laulaz commented 1 year ago

🙏