-
-
Notifications
You must be signed in to change notification settings - Fork 495
Open
Description
As requested, I am re-filing bug #407, which was closed despite the buggy code not having changed at all.
sorl-thumbnail/sorl/thumbnail/engines/base.py
Lines 67 to 70 in eb17128
| def _calculate_scaling_factor(self, x_image, y_image, geometry, options): | |
| crop = options['crop'] | |
| factors = (geometry[0] / x_image, geometry[1] / y_image) | |
| return max(factors) if crop else min(factors) |
The image will be scaled to max(factors) when crop is noop, which is incorrect. crop being set to noop is documented to scale the image the same as if crop had been unset (https://sorl-thumbnail.readthedocs.io/en/latest/template.html#crop)
Suggested change:
def _calculate_scaling_factor(self, x_image, y_image, geometry, options):
crop = options['crop']
factors = (geometry[0] / x_image, geometry[1] / y_image)
if not crop or crop == 'noop':
return min(factors)
else:
return max(factors)
Metadata
Metadata
Assignees
Labels
No labels