async-thumbnail


Nameasync-thumbnail JSON
Version 2.2 PyPI version JSON
download
home_pagehttps://gitlab.com/mediamoose/async-thumbnail/tree/v2.2
SummaryOffload sorl thumbnail rendering to a render view.
upload_time2024-07-19 07:31:05
maintainerNone
docs_urlNone
authorSven Groot (Mediamoose)
requires_pythonNone
licenseMIT
keywords async asynchronous thumbnail sorl django
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            ***************
Async thumbnail
***************

.. image:: https://badge.fury.io/py/async-thumbnail.png
    :target: https://badge.fury.io/py/async-thumbnail

Offload sorl thumbnail rendering to a render view.

Installation
============

.. code-block:: sh

    pip install async-thumbnail


Usage
=====

.. note:: Make sure you have `sorl thumbnails <https://github.com/jazzband/sorl-thumbnail>`_ configured.

.. code-block:: python

        # settings.py
        INSTALLED_APPS = (
            # ...
            'async_thumbnail',
            # ...
        )

        # urls.py
        urlpatterns = [
            # ...
            path('', include('async_thumbnail.urls')),
            # ...
        ]


.. code-block:: html

    {% load async_thumbnail %}

    <!-- Default -->
    <img src="{% async_thumbnail object.image "900x600" crop="center" %}">

    <!-- Save as var -->
    {% async_thumbnail object.image "900x600" crop="center" as im %}
    <img src="{{ im.url }}" width="{{ im.width }}" height="{{ im.height }}">


FetchFromCacheMiddleware
------------------------

When you use the default full page caching middleware, it may be a good idea
to replace it with this middleware. This prevents cache from being updated when
the content contains a render URL.

.. warning:: In case you're using things like `source sets <https://www.w3schools.com/tags/att_source_srcset.asp>`_
    or lazy loading techniques this may be a bad idea.

.. code-block:: python

    # settings.py
    MIDDLEWARE = (
        'django.middleware.cache.UpdateCacheMiddleware',
        # ...
        'async_thumbnail.middleware.FetchFromCacheMiddleware',
    )


Settings
========

``ASYNC_THUMBNAIL_ENDPOINT``
----------------------------

- Default: ``''``

Optional setting to determine an absolute path for rendering.


``ASYNC_THUMBNAIL_PATTERN_NAME``
--------------------------------

- Default: ``'async_thumbnail:render'``

Pattern name for render URL's.
            

Raw data

            {
    "_id": null,
    "home_page": "https://gitlab.com/mediamoose/async-thumbnail/tree/v2.2",
    "name": "async-thumbnail",
    "maintainer": null,
    "docs_url": null,
    "requires_python": null,
    "maintainer_email": null,
    "keywords": "async, asynchronous, thumbnail, sorl, django",
    "author": "Sven Groot (Mediamoose)",
    "author_email": "sven@mediamoose.nl",
    "download_url": "https://files.pythonhosted.org/packages/30/2e/24d936e69577841fed95f30da3d0934d27c2b03a9ce0fda4b9b08be8c0c0/async-thumbnail-2.2.tar.gz",
    "platform": null,
    "description": "***************\nAsync thumbnail\n***************\n\n.. image:: https://badge.fury.io/py/async-thumbnail.png\n    :target: https://badge.fury.io/py/async-thumbnail\n\nOffload sorl thumbnail rendering to a render view.\n\nInstallation\n============\n\n.. code-block:: sh\n\n    pip install async-thumbnail\n\n\nUsage\n=====\n\n.. note:: Make sure you have `sorl thumbnails <https://github.com/jazzband/sorl-thumbnail>`_ configured.\n\n.. code-block:: python\n\n        # settings.py\n        INSTALLED_APPS = (\n            # ...\n            'async_thumbnail',\n            # ...\n        )\n\n        # urls.py\n        urlpatterns = [\n            # ...\n            path('', include('async_thumbnail.urls')),\n            # ...\n        ]\n\n\n.. code-block:: html\n\n    {% load async_thumbnail %}\n\n    <!-- Default -->\n    <img src=\"{% async_thumbnail object.image \"900x600\" crop=\"center\" %}\">\n\n    <!-- Save as var -->\n    {% async_thumbnail object.image \"900x600\" crop=\"center\" as im %}\n    <img src=\"{{ im.url }}\" width=\"{{ im.width }}\" height=\"{{ im.height }}\">\n\n\nFetchFromCacheMiddleware\n------------------------\n\nWhen you use the default full page caching middleware, it may be a good idea\nto replace it with this middleware. This prevents cache from being updated when\nthe content contains a render URL.\n\n.. warning:: In case you're using things like `source sets <https://www.w3schools.com/tags/att_source_srcset.asp>`_\n    or lazy loading techniques this may be a bad idea.\n\n.. code-block:: python\n\n    # settings.py\n    MIDDLEWARE = (\n        'django.middleware.cache.UpdateCacheMiddleware',\n        # ...\n        'async_thumbnail.middleware.FetchFromCacheMiddleware',\n    )\n\n\nSettings\n========\n\n``ASYNC_THUMBNAIL_ENDPOINT``\n----------------------------\n\n- Default: ``''``\n\nOptional setting to determine an absolute path for rendering.\n\n\n``ASYNC_THUMBNAIL_PATTERN_NAME``\n--------------------------------\n\n- Default: ``'async_thumbnail:render'``\n\nPattern name for render URL's.",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Offload sorl thumbnail rendering to a render view.",
    "version": "2.2",
    "project_urls": {
        "Download": "https://gitlab.com/mediamoose/async-thumbnail/repository/v2.2/archive.tar.gz",
        "Homepage": "https://gitlab.com/mediamoose/async-thumbnail/tree/v2.2"
    },
    "split_keywords": [
        "async",
        " asynchronous",
        " thumbnail",
        " sorl",
        " django"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "302e24d936e69577841fed95f30da3d0934d27c2b03a9ce0fda4b9b08be8c0c0",
                "md5": "f3eed61b1177dab9a1ee6879738796d7",
                "sha256": "293ddd25da4ac53a47d41cc6fe04f838b1369925f22f292cb7b046ce3948da6e"
            },
            "downloads": -1,
            "filename": "async-thumbnail-2.2.tar.gz",
            "has_sig": false,
            "md5_digest": "f3eed61b1177dab9a1ee6879738796d7",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 8099,
            "upload_time": "2024-07-19T07:31:05",
            "upload_time_iso_8601": "2024-07-19T07:31:05.120700Z",
            "url": "https://files.pythonhosted.org/packages/30/2e/24d936e69577841fed95f30da3d0934d27c2b03a9ce0fda4b9b08be8c0c0/async-thumbnail-2.2.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-07-19 07:31:05",
    "github": false,
    "gitlab": true,
    "bitbucket": false,
    "codeberg": false,
    "gitlab_user": "mediamoose",
    "gitlab_project": "async-thumbnail",
    "lcname": "async-thumbnail"
}
        
Elapsed time: 1.22337s