plone / plone.app.tiles

Plone UI integration for plone.tiles
http://pypi.python.org/pypi/plone.app.tiles
Other
6 stars 7 forks source link

Fix imagescaling #42

Closed mamico closed 3 years ago

mamico commented 3 years ago

Small fixes to imagescaling: missing srcset initialization, and wrong scale arguments (according to latest p.namedfile).

Added test for imagescaling module.

coveralls commented 3 years ago

Coverage Status

Coverage increased (+4.4%) to 86.731% when pulling 53e7769c08fad5d838ba1f3da56740ac422d39f9 on mamico-imagescaling into 2609eceb700716daeb2c750f3508d56e89f8fc4a on master.

mamico commented 3 years ago

Looks okay. But can you say what goes wrong without this? Do you get errors? Are images not getting scaled correctly?

I have an imageScale from a field image of a persistent tile (https://github.com/plone/plone.app.tiles/blob/master/plone/app/tiles/imagescaling.py#L46), when I call the tag method (or the url method) this is the traceback:

 ...
    return img.tag(**kwargs)
  File "/var/tmp/eggs/plone.namedfile-5.4.0-py2.7.egg/plone/namedfile/scaling.py", line 118, in tag
    srcset_attr = self.srcset_attribute()
  File "/var/tmp/eggs/plone.namedfile-5.4.0-py2.7.egg/plone/namedfile/scaling.py", line 79, in srcset_attribute
    for scale in self.srcset:
AttributeError: 'ImageScale' object has no attribute 'srcset'

... and my tile rendering is broken ...