Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] djangocms_picture output picture size as float, triggers warning in chrome #117

Open
TLuesebrinck opened this issue Sep 23, 2022 · 1 comment

Comments

@TLuesebrinck
Copy link

In the 'srcset' and 'sizes' attribute of the img tag can contain float numbers.

This {{ picture_size.size.0}}w output the pixel size as 1366.0w which triggers this warning in chrome:

Failed parsing 'srcset' attribute value since its 'w' descriptor is invalid.

I solved this by using a float format filter to remove the decimal point:

{{ picture_size.size.0 | floatformat:"0" }}w

@fsbraun
Copy link
Sponsor Member

fsbraun commented Sep 23, 2022

Hello @TLuesebrinck ! Thanks very much for the suggestion! Would you be interested in creating a pull request with a fix?

@fsbraun fsbraun transferred this issue from django-cms/django-cms Sep 23, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants