{"id":15573267,"url":"https://github.com/silentsokolov/flask-thumbnails","last_synced_at":"2025-09-08T15:31:55.073Z","repository":{"id":8189936,"uuid":"9618290","full_name":"silentsokolov/flask-thumbnails","owner":"silentsokolov","description":"A simple extension to create a thumbs for the flask framework","archived":false,"fork":false,"pushed_at":"2024-04-03T16:21:09.000Z","size":73,"stargazers_count":61,"open_issues_count":4,"forks_count":22,"subscribers_count":6,"default_branch":"master","last_synced_at":"2024-04-23T19:23:56.662Z","etag":null,"topics":["flask","python","thumbnails"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/silentsokolov.png","metadata":{"files":{"readme":"README.rst","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2013-04-23T08:15:35.000Z","updated_at":"2024-06-21T19:06:03.650Z","dependencies_parsed_at":"2024-01-23T10:54:31.395Z","dependency_job_id":"666aecd9-0d5a-48fe-9059-c39bd751c08f","html_url":"https://github.com/silentsokolov/flask-thumbnails","commit_stats":{"total_commits":51,"total_committers":7,"mean_commits":7.285714285714286,"dds":0.1568627450980392,"last_synced_commit":"d5309410ecd3ccf63650a61e49912012c35e86ea"},"previous_names":[],"tags_count":10,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/silentsokolov%2Fflask-thumbnails","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/silentsokolov%2Fflask-thumbnails/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/silentsokolov%2Fflask-thumbnails/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/silentsokolov%2Fflask-thumbnails/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/silentsokolov","download_url":"https://codeload.github.com/silentsokolov/flask-thumbnails/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":232320251,"owners_count":18504974,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["flask","python","thumbnails"],"created_at":"2024-10-02T18:11:35.601Z","updated_at":"2025-09-08T15:31:55.057Z","avatar_url":"https://github.com/silentsokolov.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":".. image:: https://github.com/silentsokolov/flask-thumbnails/actions/workflows/build.yml/badge.svg\n   :target: https://github.com/silentsokolov/flask-thumbnails/actions?query=workflow%3Abuild+branch%3Amaster\n\n.. image:: https://codecov.io/gh/silentsokolov/flask-thumbnails/branch/master/graph/badge.svg\n   :target: https://codecov.io/gh/silentsokolov/flask-thumbnails\n\nflask-thumbnails\n================\n\nA simple extension to create a thumbs for the Flask\n\n\nInstallation\n------------\n\nUse your favorite Python package manager to install the app from PyPI, e.g.\n\nExample:\n\n``pip install flask-thumbnails``\n\n\nAdd ``Thumbnail`` to your extension file:\n\n.. code:: python\n\n    from flask import Flask\n    from flask_thumbnails import Thumbnail\n\n    app = Flask(__name__)\n\n    thumb = Thumbnail(app)\n\nAdd ``THUMBNAIL_MEDIA_ROOT`` and ``THUMBNAIL_MEDIA_URL`` in your settings:\n\n.. code:: python\n\n    app.config['THUMBNAIL_MEDIA_ROOT'] = '/home/www/media'\n    app.config['THUMBNAIL_MEDIA_URL'] = '/media/'\n\n\nExample usage\n-------------\n\nUse in Jinja2 template:\n\n .. code:: html\n\n    \u003cimg src=\"{{ 'image.jpg'|thumbnail('200x200') }}\" alt=\"\" /\u003e\n    \u003cimg src=\"{{ 'image.jpg'|thumbnail('200x200', crop='fit', quality=100) }}\" alt=\"\" /\u003e\n\n\nOptions\n~~~~~~~\n\n``crop='fit'`` returns a sized and cropped version of the image, cropped to the requested aspect ratio and size, `read more \u003chttp://pillow.readthedocs.org/en/latest/reference/ImageOps.html#PIL.ImageOps.fit\u003e`_.\n\n``quality=XX`` changes the quality of the output JPEG thumbnail, default ``90``.\n\n\nDevelop and Production\n----------------------\n\nProduction\n~~~~~~~~~~\n\nIn production, you need to add media directory in you web server.\n\n\nDevelop\n~~~~~~~\n\nTo service the uploaded files need a helper function, where ``/media/`` your settings ``app.config['THUMBNAIL_MEDIA_URL']``:\n\n.. code:: python\n\n    from flask import send_from_directory\n\n    @app.route('/media/\u003cregex(\"([\\w\\d_/-]+)?.(?:jpe?g|gif|png)\"):filename\u003e')\n    def media_file(filename):\n        return send_from_directory(app.config['THUMBNAIL_MEDIA_THUMBNAIL_ROOT'], filename)\n\n\nOption settings\n---------------\n\nIf you want to store the thumbnail in a folder other than the ``THUMBNAIL_MEDIA_THUMBNAIL_ROOT``, you need to set it manually:\n\n.. code:: python\n\n    app.config['THUMBNAIL_MEDIA_THUMBNAIL_ROOT'] = '/home/www/media/cache'\n    app.config['THUMBNAIL_MEDIA_THUMBNAIL_URL'] = '/media/cache/'\n    app.config['THUMBNAIL_STORAGE_BACKEND'] = 'flask_thumbnails.storage_backends.FilesystemStorageBackend'\n    app.config['THUMBNAIL_DEFAULT_FORMAT'] = 'JPEG'\n\n\nMigrate 0.X to 1.X\n------------------\n\nSince version 1.X all settings have a prefix ``THUMBNAIL_``. Example: ``MEDIA_ROOT`` -\u003e ``THUMBNAIL_MEDIA_ROOT``.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsilentsokolov%2Fflask-thumbnails","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsilentsokolov%2Fflask-thumbnails","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsilentsokolov%2Fflask-thumbnails/lists"}