Skip to content

Commit

Permalink
Merge pull request #115 from plone/maurits-ignore-height-check-for-hidpi
Browse files Browse the repository at this point in the history
Only look at width when checking if HiDPI image would be too large
  • Loading branch information
mauritsvanrees authored May 17, 2022
2 parents 171902b + 2e54b2c commit 8f910cd
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
3 changes: 3 additions & 0 deletions news/114.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Only look at the width when checking if a HiDPI image would be larger than the original.
Otherwise HiDPI srcsets are never included when the scale is defined with a height of 65536.
[maurits]
5 changes: 2 additions & 3 deletions plone/namedfile/scaling.py
Original file line number Diff line number Diff line change
Expand Up @@ -538,9 +538,8 @@ def calculate_srcset(
(orig_width, orig_height) = self.getImageSize(fieldname)
for hdScale in self.getHighPixelDensityScales():
# Don't create retina scales larger than the source image.
if (height and orig_height and orig_height < height * hdScale["scale"]) or (
width and orig_width and orig_width < width * hdScale["scale"]
):
# We only care about the width, because height might be 65536.
if width and orig_width and orig_width < width * hdScale["scale"]:
continue
parameters["quality"] = hdScale["quality"]
scale_src = storage.scale(
Expand Down

0 comments on commit 8f910cd

Please sign in to comment.