It provides two filesystem-backed image storage implementations:
Abstract base class of FileSystemStore and HttpExposedFileSystemStore.
Filesystem-backed storage implementation with hard-coded URL routing.
Filesystem-backed storage implementation with WSGI middleware which serves actual image files.
from flask import Flask
from sqlalchemy_imageattach.stores.fs import HttpExposedFileSystemStore
app = Flask(__name__)
fs_store = HttpExposedFileSystemStore('userimages', 'images/')
app.wsgi_app = fs_store.wsgi_middleware(app.wsgi_app)
WSGI middlewares that wraps the given app and serves actual image files.
fs_store = HttpExposedFileSystemStore('userimages', 'images/')
app = fs_store.wsgi_middleware(app)
Parameters: | app (collections.Callable) – the wsgi app to wrap |
---|---|
Returns: | the another wsgi app that wraps app |
Return type: | StaticServerMiddleware |
Simple static server WSGI middleware.
Parameters: |
|
---|
Finds the right filename extension (e.g. '.png') for the given mimetype (e.g. image/png).
Parameters: | mimetype (basestring) – mimetype string e.g. 'image/jpeg' |
---|---|
Returns: | filename extension for the mimetype |
Return type: | basestring |