Name | sorl-thumbnail JSON |
Version |
12.11.0
JSON |
| download |
home_page | None |
Summary | Thumbnails for Django |
upload_time | 2024-09-21 17:12:08 |
maintainer | None |
docs_url | None |
author | None |
requires_python | >=3.8 |
license | Copyright (c) 2010, Mikko Hellsing All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * Neither the name of the sorl-thumbnail the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
keywords |
django
thumbnail
sorl
|
VCS |
|
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
|jazzband-badge| |pypi| |python-badge| |django-badge| |docs| |gh-actions| |codecov|
Thumbnails for Django.
Features at a glance
====================
- Support for Django 4.2, 5.0 and 5.1 following the `Django supported versions policy`_
- Storage support
- Pluggable Engine support for `Pillow`_, `ImageMagick`_, `PIL`_, `Wand`_, `pgmagick`_, and `vipsthumbnail`_
- Pluggable Key Value Store support (cached db, redis, and dynamodb by AWS)
- Pluggable Backend support
- Admin integration with possibility to delete
- Dummy generation (placeholders)
- Flexible, simple syntax, generates no html
- ImageField for model that deletes thumbnails (only compatible with django 1.2.5 or less)
- CSS style cropping options
- Back smart cropping, and remove borders from the images when cropping
- Margin calculation for vertical positioning
- Alternative resolutions versions of a thumbnail
Read more in `the documentation (latest version) <https://sorl-thumbnail.readthedocs.io/>`_
Developers
==========
|jazzband|
This is a `Jazzband <https://jazzband.co>`_ project. By contributing you agree to
abide by the `Contributor Code of Conduct <https://jazzband.co/about/conduct>`_
and follow the `guidelines <https://jazzband.co/about/guidelines>`_.
Feel free to create a new Pull request if you want to propose a new feature.
If you need development support or want to discuss with other developers
join us in the channel #sorl-thumbnail at freenode.net or Gitter.
For releases updates and more in deep development discussion use our mailing list
in Google Groups.
- IRC Channel: irc://irc.freenode.net/#sorl-thumbnail
- Mailing List: sorl-thumbnail@googlegroups.com https://groups.google.com/d/forum/sorl-thumbnail
Tests
-----
The tests should run with tox. Running `tox` will run all tests for all environments.
However, it is possible to run a certain environment with `tox -e <env>`, a list of all environments
can be found with `tox -l`. These tests require the dependencies of the different engines defined in
the documentation. It is possible to install these dependencies into a vagrant image with the
Vagrantfile in the repo.
User Support
============
If you need help using sorl-thumbnail browse https://stackoverflow.com/questions/tagged/sorl-thumbnail
and posts your questions with the `sorl-thumbnail` tag.
How to Use
==========
Get the code
------------
Getting the code for the latest stable release use 'pip'. ::
$ pip install sorl-thumbnail
Install in your project
-----------------------
Then register 'sorl.thumbnail', in the 'INSTALLED_APPS' section of
your project's settings. ::
INSTALLED_APPS = [
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'sorl.thumbnail',
]
Templates Usage
---------------
All of the examples assume that you first load the thumbnail template tag in
your template.::
{% load thumbnail %}
A simple usage. ::
{% thumbnail item.image "100x100" crop="center" as im %}
<img src="{{ im.url }}" width="{{ im.width }}" height="{{ im.height }}">
{% endthumbnail %}
See more examples in the section `Template examples`_ in the Documentation
Model Usage
-----------
Using the ImageField that automatically deletes references to itself in the key
value store and its thumbnail references and the thumbnail files when deleted.
Please note that this is only compatible with django 1.2.5 or less.::
from django.db import models
from sorl.thumbnail import ImageField
class Item(models.Model):
image = ImageField(upload_to='whatever')
See more examples in the section `Model examples`_ in the Documentation
Low level API
-------------
You can use the 'get_thumbnail'::
from sorl.thumbnail import get_thumbnail
from sorl.thumbnail import delete
im = get_thumbnail(my_file, '100x100', crop='center', quality=99)
delete(my_file)
See more examples in the section `Low level API examples`_ in the Documentation
Using in combination with other thumbnailers
--------------------------------------------
Alternatively, you load the templatetags by {% load sorl_thumbnail %}
instead of traditional {% load thumbnail %}. It's especially useful in
projects that do make use of multiple thumbnailer libraries that use the
same name (``thumbnail``) for the templatetag module::
{% load sorl_thumbnail %}
{% thumbnail item.image "100x100" crop="center" as im %}
<img src="{{ im.url }}" width="{{ im.width }}" height="{{ im.height }}">
{% endthumbnail %}
Frequently asked questions
==========================
Is so slow in Amazon S3!
------------------------
Possible related to the implementation of your Amazon S3 Backend, see the `issue #351`_
due the storage backend reviews if there is an existing thumbnail when tries to
generate the thumbnail that makes an extensive use of the S3 API
A fast workaround if you are not willing to tweak your storage backend is to set::
THUMBNAIL_FORCE_OVERWRITE = True
So it will avoid to overly query the S3 API.
.. |gh-actions| image:: https://github.com/jazzband/sorl-thumbnail/workflows/Test/badge.svg
:target: https://github.com/jazzband/sorl-thumbnail/actions
.. |docs| image:: https://readthedocs.org/projects/pip/badge/?version=latest
:alt: Documentation for latest version
:target: https://sorl-thumbnail.readthedocs.io/en/latest/
.. |pypi| image:: https://img.shields.io/pypi/v/sorl-thumbnail.svg
:target: https://pypi.python.org/pypi/sorl-thumbnail
:alt: sorl-thumbnail on PyPI
.. |python-badge| image:: https://img.shields.io/pypi/pyversions/sorl-thumbnail.svg
:target: https://pypi.python.org/pypi/sorl-thumbnail
:alt: Supported Python versions
.. |django-badge| image:: https://img.shields.io/pypi/djversions/sorl-thumbnail.svg
:target: https://pypi.python.org/pypi/sorl-thumbnail
:alt: Supported Python versions
.. |codecov| image:: https://codecov.io/gh/jazzband/sorl-thumbnail/branch/master/graph/badge.svg
:target: https://codecov.io/gh/jazzband/sorl-thumbnail
:alt: Coverage
.. |jazzband-badge| image:: https://jazzband.co/static/img/badge.svg
:target: https://jazzband.co/
:alt: Jazzband
.. |jazzband| image:: https://jazzband.co/static/img/jazzband.svg
:target: https://jazzband.co/
:alt: Jazzband
.. _`Pillow`: https://pillow.readthedocs.io/
.. _`ImageMagick`: https://imagemagick.org/
.. _`PIL`: https://python-pillow.org/
.. _`Wand`: https://docs.wand-py.org/
.. _`pgmagick`: https://pgmagick.readthedocs.io/
.. _`vipsthumbnail`: https://www.libvips.org/API/current/Using-vipsthumbnail.html
.. _`Template examples`: https://sorl-thumbnail.readthedocs.io/en/latest/examples.html#template-examples
.. _`Model examples`: https://sorl-thumbnail.readthedocs.io/en/latest/examples.html#model-examples
.. _`Low level API examples`: https://sorl-thumbnail.readthedocs.io/en/latest/examples.html#low-level-api-examples
.. _`issue #351`: https://github.com/jazzband/sorl-thumbnail/issues/351
.. _`Django supported versions policy`: https://www.djangoproject.com/download/#supported-versions
Raw data
{
"_id": null,
"home_page": null,
"name": "sorl-thumbnail",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.8",
"maintainer_email": "Jazzband <roadies@jazzband.co>",
"keywords": "django, thumbnail, sorl",
"author": null,
"author_email": "Mikko Hellsing <mikko@aino.se>",
"download_url": "https://files.pythonhosted.org/packages/28/e9/38491b3556c2ec19b53d0dcc5474359fb9344ce24a26745d3ca88237b848/sorl_thumbnail-12.11.0.tar.gz",
"platform": null,
"description": "|jazzband-badge| |pypi| |python-badge| |django-badge| |docs| |gh-actions| |codecov|\n\nThumbnails for Django.\n\nFeatures at a glance\n====================\n\n- Support for Django 4.2, 5.0 and 5.1 following the `Django supported versions policy`_\n- Storage support\n- Pluggable Engine support for `Pillow`_, `ImageMagick`_, `PIL`_, `Wand`_, `pgmagick`_, and `vipsthumbnail`_\n- Pluggable Key Value Store support (cached db, redis, and dynamodb by AWS)\n- Pluggable Backend support\n- Admin integration with possibility to delete\n- Dummy generation (placeholders)\n- Flexible, simple syntax, generates no html\n- ImageField for model that deletes thumbnails (only compatible with django 1.2.5 or less)\n- CSS style cropping options\n- Back smart cropping, and remove borders from the images when cropping\n- Margin calculation for vertical positioning\n- Alternative resolutions versions of a thumbnail\n\nRead more in `the documentation (latest version) <https://sorl-thumbnail.readthedocs.io/>`_\n\nDevelopers\n==========\n\n|jazzband|\n\nThis is a `Jazzband <https://jazzband.co>`_ project. By contributing you agree to\nabide by the `Contributor Code of Conduct <https://jazzband.co/about/conduct>`_\nand follow the `guidelines <https://jazzband.co/about/guidelines>`_.\n\nFeel free to create a new Pull request if you want to propose a new feature.\nIf you need development support or want to discuss with other developers\njoin us in the channel #sorl-thumbnail at freenode.net or Gitter.\n\nFor releases updates and more in deep development discussion use our mailing list\nin Google Groups.\n\n- IRC Channel: irc://irc.freenode.net/#sorl-thumbnail\n\n- Mailing List: sorl-thumbnail@googlegroups.com https://groups.google.com/d/forum/sorl-thumbnail\n\nTests\n-----\nThe tests should run with tox. Running `tox` will run all tests for all environments.\nHowever, it is possible to run a certain environment with `tox -e <env>`, a list of all environments\ncan be found with `tox -l`. These tests require the dependencies of the different engines defined in\nthe documentation. It is possible to install these dependencies into a vagrant image with the\nVagrantfile in the repo.\n\nUser Support\n============\n\nIf you need help using sorl-thumbnail browse https://stackoverflow.com/questions/tagged/sorl-thumbnail\nand posts your questions with the `sorl-thumbnail` tag.\n\n\nHow to Use\n==========\n\nGet the code\n------------\n\nGetting the code for the latest stable release use 'pip'. ::\n\n $ pip install sorl-thumbnail\n\nInstall in your project\n-----------------------\n\nThen register 'sorl.thumbnail', in the 'INSTALLED_APPS' section of\nyour project's settings. ::\n\n INSTALLED_APPS = [\n 'django.contrib.admin',\n 'django.contrib.auth',\n 'django.contrib.contenttypes',\n 'django.contrib.sessions',\n 'django.contrib.messages',\n 'django.contrib.staticfiles',\n\n 'sorl.thumbnail',\n ]\n\n\nTemplates Usage\n---------------\n\nAll of the examples assume that you first load the thumbnail template tag in\nyour template.::\n\n {% load thumbnail %}\n\n\nA simple usage. ::\n\n {% thumbnail item.image \"100x100\" crop=\"center\" as im %}\n <img src=\"{{ im.url }}\" width=\"{{ im.width }}\" height=\"{{ im.height }}\">\n {% endthumbnail %}\n\nSee more examples in the section `Template examples`_ in the Documentation\n\nModel Usage\n-----------\n\nUsing the ImageField that automatically deletes references to itself in the key\nvalue store and its thumbnail references and the thumbnail files when deleted.\nPlease note that this is only compatible with django 1.2.5 or less.::\n\n from django.db import models\n from sorl.thumbnail import ImageField\n\n class Item(models.Model):\n image = ImageField(upload_to='whatever')\n\nSee more examples in the section `Model examples`_ in the Documentation\n\nLow level API\n-------------\n\nYou can use the 'get_thumbnail'::\n\n from sorl.thumbnail import get_thumbnail\n from sorl.thumbnail import delete\n\n im = get_thumbnail(my_file, '100x100', crop='center', quality=99)\n delete(my_file)\n\nSee more examples in the section `Low level API examples`_ in the Documentation\n\nUsing in combination with other thumbnailers\n--------------------------------------------\n\nAlternatively, you load the templatetags by {% load sorl_thumbnail %}\ninstead of traditional {% load thumbnail %}. It's especially useful in\nprojects that do make use of multiple thumbnailer libraries that use the\nsame name (``thumbnail``) for the templatetag module::\n\n {% load sorl_thumbnail %}\n {% thumbnail item.image \"100x100\" crop=\"center\" as im %}\n <img src=\"{{ im.url }}\" width=\"{{ im.width }}\" height=\"{{ im.height }}\">\n {% endthumbnail %}\n\nFrequently asked questions\n==========================\n\nIs so slow in Amazon S3!\n------------------------\n\nPossible related to the implementation of your Amazon S3 Backend, see the `issue #351`_\ndue the storage backend reviews if there is an existing thumbnail when tries to\ngenerate the thumbnail that makes an extensive use of the S3 API\n\nA fast workaround if you are not willing to tweak your storage backend is to set::\n\n THUMBNAIL_FORCE_OVERWRITE = True\n\nSo it will avoid to overly query the S3 API.\n\n\n.. |gh-actions| image:: https://github.com/jazzband/sorl-thumbnail/workflows/Test/badge.svg\n :target: https://github.com/jazzband/sorl-thumbnail/actions\n.. |docs| image:: https://readthedocs.org/projects/pip/badge/?version=latest\n :alt: Documentation for latest version\n :target: https://sorl-thumbnail.readthedocs.io/en/latest/\n.. |pypi| image:: https://img.shields.io/pypi/v/sorl-thumbnail.svg\n :target: https://pypi.python.org/pypi/sorl-thumbnail\n :alt: sorl-thumbnail on PyPI\n.. |python-badge| image:: https://img.shields.io/pypi/pyversions/sorl-thumbnail.svg\n :target: https://pypi.python.org/pypi/sorl-thumbnail\n :alt: Supported Python versions\n.. |django-badge| image:: https://img.shields.io/pypi/djversions/sorl-thumbnail.svg\n :target: https://pypi.python.org/pypi/sorl-thumbnail\n :alt: Supported Python versions\n.. |codecov| image:: https://codecov.io/gh/jazzband/sorl-thumbnail/branch/master/graph/badge.svg\n :target: https://codecov.io/gh/jazzband/sorl-thumbnail\n :alt: Coverage\n.. |jazzband-badge| image:: https://jazzband.co/static/img/badge.svg\n :target: https://jazzband.co/\n :alt: Jazzband\n.. |jazzband| image:: https://jazzband.co/static/img/jazzband.svg\n :target: https://jazzband.co/\n :alt: Jazzband\n\n.. _`Pillow`: https://pillow.readthedocs.io/\n.. _`ImageMagick`: https://imagemagick.org/\n.. _`PIL`: https://python-pillow.org/\n.. _`Wand`: https://docs.wand-py.org/\n.. _`pgmagick`: https://pgmagick.readthedocs.io/\n.. _`vipsthumbnail`: https://www.libvips.org/API/current/Using-vipsthumbnail.html\n\n.. _`Template examples`: https://sorl-thumbnail.readthedocs.io/en/latest/examples.html#template-examples\n.. _`Model examples`: https://sorl-thumbnail.readthedocs.io/en/latest/examples.html#model-examples\n.. _`Low level API examples`: https://sorl-thumbnail.readthedocs.io/en/latest/examples.html#low-level-api-examples\n.. _`issue #351`: https://github.com/jazzband/sorl-thumbnail/issues/351\n.. _`Django supported versions policy`: https://www.djangoproject.com/download/#supported-versions\n",
"bugtrack_url": null,
"license": "Copyright (c) 2010, Mikko Hellsing All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * Neither the name of the sorl-thumbnail the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ",
"summary": "Thumbnails for Django",
"version": "12.11.0",
"project_urls": {
"Homepage": "https://sorl-thumbnail.readthedocs.io/en/latest/",
"Repository": "https://github.com/jazzband/sorl-thumbnail"
},
"split_keywords": [
"django",
" thumbnail",
" sorl"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "bfb44ff585c7b096fe82e55ee8d1dbae74f5f7cedacbf08cb25c9a83755e4ef3",
"md5": "dc6c50e7850fff6792576987c88b6611",
"sha256": "e3e375013ca3f14bca9f98fe9861153adac3a6ea4af5e9dc3f31cb605df765b5"
},
"downloads": -1,
"filename": "sorl_thumbnail-12.11.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "dc6c50e7850fff6792576987c88b6611",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.8",
"size": 42789,
"upload_time": "2024-09-21T17:11:54",
"upload_time_iso_8601": "2024-09-21T17:11:54.110505Z",
"url": "https://files.pythonhosted.org/packages/bf/b4/4ff585c7b096fe82e55ee8d1dbae74f5f7cedacbf08cb25c9a83755e4ef3/sorl_thumbnail-12.11.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "28e938491b3556c2ec19b53d0dcc5474359fb9344ce24a26745d3ca88237b848",
"md5": "dccf71359dd479f57db1a0d6e4a2d1c1",
"sha256": "191b89c27ecb40b5c2a35549d557d17c4841c6aff439b2e17b938b91eea463b3"
},
"downloads": -1,
"filename": "sorl_thumbnail-12.11.0.tar.gz",
"has_sig": false,
"md5_digest": "dccf71359dd479f57db1a0d6e4a2d1c1",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.8",
"size": 667102,
"upload_time": "2024-09-21T17:12:08",
"upload_time_iso_8601": "2024-09-21T17:12:08.585485Z",
"url": "https://files.pythonhosted.org/packages/28/e9/38491b3556c2ec19b53d0dcc5474359fb9344ce24a26745d3ca88237b848/sorl_thumbnail-12.11.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-09-21 17:12:08",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "jazzband",
"github_project": "sorl-thumbnail",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"tox": true,
"lcname": "sorl-thumbnail"
}