All Projects β†’ silentsokolov β†’ flask-thumbnails

silentsokolov / flask-thumbnails

Licence: MIT license
A simple extension to create a thumbs for the flask framework

Programming Languages

python
139335 projects - #7 most used programming language
Makefile
30231 projects

Projects that are alternatives of or similar to flask-thumbnails

Fb2mobi
[DEPRECATED] fb2mobi - derived from fb2conv 1.5.4
Stars: ✭ 89 (+50.85%)
Mutual labels:  thumbnails
Gallery shell
πŸ“· Bash Script to generate static responsive image web galleries.
Stars: ✭ 198 (+235.59%)
Mutual labels:  thumbnails
imtool
πŸ–ΌοΈ Client-side canvas-based image manipulation library.
Stars: ✭ 38 (-35.59%)
Mutual labels:  thumbnails
React Native Thumbnail Video
Easily show thumbnails for videos on react-native.
Stars: ✭ 104 (+76.27%)
Mutual labels:  thumbnails
Cantaloupe
High-performance dynamic image server in Java
Stars: ✭ 186 (+215.25%)
Mutual labels:  thumbnails
Epeg
Insanely fast JPEG/ JPG thumbnail scaling with the minimum fuss and CPU overhead. It makes use of libjpeg features of being able to load an image by only decoding the DCT coefficients needed to reconstruct an image of the size desired.
Stars: ✭ 220 (+272.88%)
Mutual labels:  thumbnails
Mt
yet another media thumber. Generate Video Contat Sheets easily. http://mutschler.github.io/mt
Stars: ✭ 76 (+28.81%)
Mutual labels:  thumbnails
laravel-thumbnails
Laravel Package for making thumbnails instantly
Stars: ✭ 51 (-13.56%)
Mutual labels:  thumbnails
Video Thumbnail Generator
πŸ“· Generate thumbnail sprites from videos.
Stars: ✭ 190 (+222.03%)
Mutual labels:  thumbnails
MementoEmbed
A service that provides archive-aware oEmbed-compatible embeddable surrogates (social cards, thumbnails, etc.) for archived web pages (mementos).
Stars: ✭ 13 (-77.97%)
Mutual labels:  thumbnails
Python Thumbnails
Thumbnails for Django, Flask and other Python projects. 🌈
Stars: ✭ 111 (+88.14%)
Mutual labels:  thumbnails
Thumb
A simple, local image only, thumbnail generation script written in PHP
Stars: ✭ 119 (+101.69%)
Mutual labels:  thumbnails
Lsix
Like "ls", but for images. Shows thumbnails in terminal using sixel graphics.
Stars: ✭ 2,635 (+4366.1%)
Mutual labels:  thumbnails
Ontopreplica
A real-time always-on-top β€œreplica” of a window of your choice (on Windows).
Stars: ✭ 1,336 (+2164.41%)
Mutual labels:  thumbnails
lamba-thumbnailer
AWS S3 Video Thumbnailer with Lambda
Stars: ✭ 21 (-64.41%)
Mutual labels:  thumbnails
Fb2converter
Unified converter of FB2 files into epub2, kepub, mobi and azw3 formats.
Stars: ✭ 83 (+40.68%)
Mutual labels:  thumbnails
Vcsi
Create video contact sheets, thumbnails
Stars: ✭ 219 (+271.19%)
Mutual labels:  thumbnails
BlenderQuickLook
A Quick Look Plugin for generating Blender3D file thumbnails.
Stars: ✭ 36 (-38.98%)
Mutual labels:  thumbnails
nano photos provider2
PHP photos provider for nanogallery2
Stars: ✭ 37 (-37.29%)
Mutual labels:  thumbnails
Node S3 Uploader
Flexible and efficient resize, rename, and upload images to Amazon S3 disk storage. Uses the official AWS Node SDK for transfer, and ImageMagick for image processing. Support for multiple image versions targets.
Stars: ✭ 237 (+301.69%)
Mutual labels:  thumbnails
https://github.com/silentsokolov/flask-thumbnails/workflows/build/badge.svg?branch=master

flask-thumbnails

A simple extension to create a thumbs for the Flask

Installation

Use your favorite Python package manager to install the app from PyPI, e.g.

Example:

pip install flask-thumbnails

Add Thumbnail to your extension file:

from flask import Flask
from flask_thumbnails import Thumbnail

app = Flask(__name__)

thumb = Thumbnail(app)

Add THUMBNAIL_MEDIA_ROOT and THUMBNAIL_MEDIA_URL in your settings:

app.config['THUMBNAIL_MEDIA_ROOT'] = '/home/www/media'
app.config['THUMBNAIL_MEDIA_URL'] = '/media/'

Example usage

Use in Jinja2 template:

<img src="{{ 'image.jpg'|thumbnail('200x200') }}" alt="" />
<img src="{{ 'image.jpg'|thumbnail('200x200', crop='fit', quality=100) }}" alt="" />

Options

crop='fit' returns a sized and cropped version of the image, cropped to the requested aspect ratio and size, read more.

quality=XX changes the quality of the output JPEG thumbnail, default 90.

Develop and Production

Production

In production, you need to add media directory in you web server.

Develop

To service the uploaded files need a helper function, where /media/ your settings app.config['THUMBNAIL_MEDIA_URL']:

from flask import send_from_directory

@app.route('/media/<regex("([\w\d_/-]+)?.(?:jpe?g|gif|png)"):filename>')
def media_file(filename):
    return send_from_directory(app.config['THUMBNAIL_MEDIA_THUMBNAIL_ROOT'], filename)

Option settings

If you want to store the thumbnail in a folder other than the THUMBNAIL_MEDIA_THUMBNAIL_ROOT, you need to set it manually:

app.config['THUMBNAIL_MEDIA_THUMBNAIL_ROOT'] = '/home/www/media/cache'
app.config['THUMBNAIL_MEDIA_THUMBNAIL_URL'] = '/media/cache/'
app.config['THUMBNAIL_STORAGE_BACKEND'] = 'flask_thumbnails.storage_backends.FilesystemStorageBackend'
app.config['THUMBNAIL_DEFAULT_FORMAT'] = 'JPEG'

Migrate 0.X to 1.X

Since version 1.X all settings have a prefix THUMBNAIL_. Example: MEDIA_ROOT -> THUMBNAIL_MEDIA_ROOT.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].