Limit image scales to those smaller than the original#1992
Limit image scales to those smaller than the original#1992
Conversation
|
@davisagli thanks for creating this Pull Request and helping to improve Plone! TL;DR: Finish pushing changes, pass all other checks, then paste a comment: To ensure that these changes do not break other parts of Plone, the Plone test suite matrix needs to pass, but it takes 30-60 min. Other CI checks are usually much faster and the Plone Jenkins resources are limited, so when done pushing changes and all other checks pass either start all Jenkins PR jobs yourself, or simply add the comment above in this PR to start all the jobs automatically. Happy hacking! |
|
@jenkins-plone-org please run jobs |
jensens
left a comment
There was a problem hiding this comment.
You need an exception for SVG images.
|
@jensens Why an exception for SVG images? |
mauritsvanrees
left a comment
There was a problem hiding this comment.
Makes sense.
I suppose for SVG a larger scale does not bloat the database, as we scale this by editing the XML contents. Use here in plone.namedfile after checking the content type. So this could work:
if actual_width > width and getattr(field, "contentType", "") != "image/svg+xml"
This makes the serialization of scales for image fields more consistent with the set of scales that comes from image_scales in catalog results. And it avoids storing duplicate data for large scales.
Related to plone/volto#7655
📚 Documentation preview 📚: https://plonerestapi--1992.org.readthedocs.build/