diff --git a/.github/workflows/plone-package.yml b/.github/workflows/plone-package.yml index 7577f41..04f8e44 100644 --- a/.github/workflows/plone-package.yml +++ b/.github/workflows/plone-package.yml @@ -16,24 +16,8 @@ jobs: fail-fast: false matrix: plone-version: - - "Plone60" - - "Plone61" - "Plone62" - python-version: ["3.9", "3.10", "3.11", "3.12", "3.13", "3.14"] - - exclude: - - plone-version: "Plone60" - python-version: "3.12" - - plone-version: "Plone60" - python-version: "3.13" - - plone-version: "Plone60" - python-version: "3.14" - - plone-version: "Plone61" - python-version: "3.9" - - plone-version: "Plone61" - python-version: "3.14" - - plone-version: "Plone62" - python-version: "3.9" + python-version: ["3.10", "3.11", "3.12", "3.13", "3.14"] steps: - uses: actions/setup-python@v4 diff --git a/.long-description.html b/.long-description.html new file mode 100644 index 0000000..f728e9b --- /dev/null +++ b/.long-description.html @@ -0,0 +1,537 @@ + + +
+ + +Backport of the srcset method added to the @@images view in plone.namedfile 7.1.0 to be able to use it in older Plone versions. +It also includes an optimized @@image_helper view for Plone 6+ that uses catalog metadata to avoid N+1 performance issues in listings.
+Read more about responsive images and its use in the MDN documentation
+@@images-srcset
+You should use this view like this
++<img tal:define="images context/@@images-srcset;" + tal:replace="structure python:images.srcset( + fieldname='image', + scale_in_src='huge', + sizes='(min-width: 570px) 550px,90vw', + css_class='mini w-100 h-100 responsive-3-2', + alt=context.Title(), + title=context.Title(), + loading='lazy')" +/> ++
The meaning of each parameter is the following:
+@@image_helper
+This view is designed for high-performance listings in Plone 6. +It attempts to generate the <img> tag using only catalog metadata (image_scales attribute in brains), avoiding expensive getObject() calls. +If metadata is missing, it gracefully falls back to the standard @@images view logic.
+You should use this view like this
++<tal:block tal:define="helper context/@@image_helper"> + <div tal:replace="structure python:helper.srcset(item, fieldname='image', sizes='25vw', css_class='my-img')" /> +</tal:block> ++
Available methods:
+Parameters:
+Note: Unlike standard Plone views, this helper does not provide default values for alt or loading attributes. +Developers must provide them explicitly in the template if needed. +However, it does automatically provide width and height based on the rendered scale to prevent layout shifts.
+Install cs.srcset by adding it to your buildout:
++[buildout] + +... + +eggs = + cs.srcset ++
and then running bin/buildout
+NOTE: You do not need to install the product in the Plone add-ons controlpanel, there is nothing to be installed.
+If you are having issues, please let us know.
+The project is licensed under the GPLv2.
+Breaking changes
+New features
+