.. This README is meant for consumption by humans and PyPI. PyPI can render rst files so please do not use Sphinx features.
If you want to learn more about writing documentation, please check out: http://docs.plone.org/about/documentation_styleguide.html
This text does not appear on PyPI or github. It is a comment.
.. image:: https://github.com/codesyntax/cs.srcset/actions/workflows/plone-package.yml/badge.svg
:target: https://github.com/codesyntax/cs.srcset/actions/workflows/plone-package.yml
.. image:: https://img.shields.io/pypi/v/cs.srcset.svg
:target: https://pypi.python.org/pypi/cs.srcset/
:alt: Latest Version
.. image:: https://img.shields.io/pypi/status/cs.srcset.svg
:target: https://pypi.python.org/pypi/cs.srcset
:alt: Egg Status
.. image:: https://img.shields.io/pypi/pyversions/cs.srcset.svg?style=plastic :alt: Supported - Python Versions
.. image:: https://img.shields.io/pypi/l/cs.srcset.svg
:target: https://pypi.python.org/pypi/cs.srcset/
:alt: License
=========
cs.srcset
=========
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
Features
--------
It adds a view called `@@images-srcset` that has a single method called `srcset` to be able to create an `img` tag with the `srcset` and `sizes`
attributes to render responsive images.
Read more about responsive images and its use in the `MDN documentation`_
Documentation
-------------
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:
- fieldname: name of the field where the image is stored
- scale_in_src: name of the scale that will be used to render the src attribute
- sizes: the value of the sizes attribute in the output tag
- css_class: CSS classes added to the img tag
- additional attributes: any aditional attribute that will be rendered in the img tag, useful to add the title, alt, loading, fetchpriority, id, and other attributes.
Installation
------------
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.
Contribute
----------
- Issue Tracker: https://github.com/codesyntax/cs.srcset/issues
- Source Code: https://github.com/codesyntax/cs.srcset
Support
-------
If you are having issues, please let us know.
License
-------
The project is licensed under the GPLv2.
.. _`MDN documentation`: https://developer.mozilla.org/en-US/docs/Web/HTML/Guides/Responsive_images
Contributors
============
- Mikel Larreategi, mlarreategi@codesyntax.com
Changelog
=========
1.1 (2025-10-14)
----------------
- Add default width and heigth attributes if none provided when using the srcset method
[erral]
1.0 (2025-09-24)
----------------
- Initial release.
[codesyntax]
Raw data
{
"_id": null,
"home_page": "https://github.com/codesyntax/cs.srcset",
"name": "cs.srcset",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.7",
"maintainer_email": null,
"keywords": "Python Plone CMS",
"author": "Mikel Larreategi",
"author_email": "mlarreategi@codesyntax.com",
"download_url": "https://files.pythonhosted.org/packages/ce/d4/a475d580a5682980e2976ffee54f20ddb051942a404ff1a385adb4e5ba89/cs_srcset-1.1.tar.gz",
"platform": null,
"description": ".. This README is meant for consumption by humans and PyPI. PyPI can render rst files so please do not use Sphinx features.\n If you want to learn more about writing documentation, please check out: http://docs.plone.org/about/documentation_styleguide.html\n This text does not appear on PyPI or github. It is a comment.\n\n.. image:: https://github.com/codesyntax/cs.srcset/actions/workflows/plone-package.yml/badge.svg\n :target: https://github.com/codesyntax/cs.srcset/actions/workflows/plone-package.yml\n\n.. image:: https://img.shields.io/pypi/v/cs.srcset.svg\n :target: https://pypi.python.org/pypi/cs.srcset/\n :alt: Latest Version\n\n.. image:: https://img.shields.io/pypi/status/cs.srcset.svg\n :target: https://pypi.python.org/pypi/cs.srcset\n :alt: Egg Status\n\n.. image:: https://img.shields.io/pypi/pyversions/cs.srcset.svg?style=plastic :alt: Supported - Python Versions\n\n.. image:: https://img.shields.io/pypi/l/cs.srcset.svg\n :target: https://pypi.python.org/pypi/cs.srcset/\n :alt: License\n\n\n=========\ncs.srcset\n=========\n\nBackport 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\n\nFeatures\n--------\n\nIt adds a view called `@@images-srcset` that has a single method called `srcset` to be able to create an `img` tag with the `srcset` and `sizes`\nattributes to render responsive images.\n\nRead more about responsive images and its use in the `MDN documentation`_\n\n\nDocumentation\n-------------\n\nYou should use this view like this ::\n\n <img tal:define=\"images context/@@images-srcset;\"\n tal:replace=\"structure python:images.srcset(\n fieldname='image',\n scale_in_src='huge',\n sizes='(min-width: 570px) 550px,90vw',\n css_class='mini w-100 h-100 responsive-3-2',\n alt=context.Title(),\n title=context.Title(),\n loading='lazy')\"\n />\n\nThe meaning of each parameter is the following:\n\n- fieldname: name of the field where the image is stored\n- scale_in_src: name of the scale that will be used to render the src attribute\n- sizes: the value of the sizes attribute in the output tag\n- css_class: CSS classes added to the img tag\n- additional attributes: any aditional attribute that will be rendered in the img tag, useful to add the title, alt, loading, fetchpriority, id, and other attributes.\n\n\n\n\n\nInstallation\n------------\n\nInstall cs.srcset by adding it to your buildout::\n\n [buildout]\n\n ...\n\n eggs =\n cs.srcset\n\n\nand then running ``bin/buildout``\n\n**NOTE**: You do not need to install the product in the Plone add-ons controlpanel, there is nothing to be installed.\n\n\n\nContribute\n----------\n\n- Issue Tracker: https://github.com/codesyntax/cs.srcset/issues\n- Source Code: https://github.com/codesyntax/cs.srcset\n\n\nSupport\n-------\n\nIf you are having issues, please let us know.\n\n\nLicense\n-------\n\nThe project is licensed under the GPLv2.\n\n.. _`MDN documentation`: https://developer.mozilla.org/en-US/docs/Web/HTML/Guides/Responsive_images\n\n\nContributors\n============\n\n- Mikel Larreategi, mlarreategi@codesyntax.com\n\n\nChangelog\n=========\n\n\n1.1 (2025-10-14)\n----------------\n\n- Add default width and heigth attributes if none provided when using the srcset method\n [erral]\n\n1.0 (2025-09-24)\n----------------\n\n- Initial release.\n [codesyntax]\n",
"bugtrack_url": null,
"license": "GPL version 2",
"summary": "An add-on for Plone",
"version": "1.1",
"project_urls": {
"Homepage": "https://github.com/codesyntax/cs.srcset",
"PyPI": "https://pypi.org/project/cs.srcset/",
"Source": "https://github.com/codesyntax/cs.srcset",
"Tracker": "https://github.com/codesyntax/cs.srcset/issues"
},
"split_keywords": [
"python",
"plone",
"cms"
],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "169b57070159f9593ba258a561e1369022f75cb88faf8d7727884e7c2c47caf9",
"md5": "7fe982d5cbcf83ca988f30e43c20aa5b",
"sha256": "7b04e69436830eec655c69d59a843ee6fddeaec74ecae484da3dde22cca5372b"
},
"downloads": -1,
"filename": "cs.srcset-1.1-py3-none-any.whl",
"has_sig": false,
"md5_digest": "7fe982d5cbcf83ca988f30e43c20aa5b",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.7",
"size": 19229,
"upload_time": "2025-10-14T09:39:41",
"upload_time_iso_8601": "2025-10-14T09:39:41.759121Z",
"url": "https://files.pythonhosted.org/packages/16/9b/57070159f9593ba258a561e1369022f75cb88faf8d7727884e7c2c47caf9/cs.srcset-1.1-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "ced4a475d580a5682980e2976ffee54f20ddb051942a404ff1a385adb4e5ba89",
"md5": "6291ad6c933ef2bffcebde9792ba3d53",
"sha256": "68c49feb30139f2405f481e09846d7d9bd340f9ca11b42505338fbcdbf38a08b"
},
"downloads": -1,
"filename": "cs_srcset-1.1.tar.gz",
"has_sig": false,
"md5_digest": "6291ad6c933ef2bffcebde9792ba3d53",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.7",
"size": 22320,
"upload_time": "2025-10-14T09:39:42",
"upload_time_iso_8601": "2025-10-14T09:39:42.849344Z",
"url": "https://files.pythonhosted.org/packages/ce/d4/a475d580a5682980e2976ffee54f20ddb051942a404ff1a385adb4e5ba89/cs_srcset-1.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-10-14 09:39:42",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "codesyntax",
"github_project": "cs.srcset",
"travis_ci": true,
"coveralls": true,
"github_actions": true,
"requirements": [],
"tox": true,
"lcname": "cs.srcset"
}