Skip to main content

Simple images serving service,

Project description

ImageButler

Simple image server built on Flask.

Developed Python version: Python 3.6.

Installation

Using pip

pip install ImageButler

Configuration & Environment Variables

Create image_butler.conf referring following example:

SQLALCHEMY_DATABASE_URI = 'sqlite:////<path-to-your>/ImageButler.db'
SERVER_NAME = 'image.local-domain:5000'
REDISLITE_PATH = '<path-to-your>/ImageButler.rdb'
REDISLITE_WORKER_PID = '<path-to-your>/workers.pid'

Export environment variables:

export FLASK_APP=imagebutler
export IMAGEBUTLER_CONFIGS=path/to/your/image_butler.conf

For others configuration please referring to documents of Flask, Flask-Login, Flask-SQLAlchemy… (please check requirements.txt).

Database Init

flask db init
flask db migrate
flask db upgrade

Note: - For MySQL and MariaDB please don’t create your database in utf8_bin collate since it will break the application. - Also for MySQL and MariaDB, after run the migrate command, go and edit your migrations/versions/<some-hex>_.py

from sqlalchemy.dialects.mysql import LONGBLOB
# ...
# ... replace the old fileContent line with
sa.Column('fileContent', LONGBLOB(), nullable=False),
# ...

Run

flask run

User management

flask user create your@email.address
flask user get your@email.address
flask user change_pass your@email.address

Upload images

For example we use cURL to upload the image.

curl -X POST \
    http://image.local-domain:5000/api/v0/image \
    -H 'content-type: multipart/form-data' \
    -F 'file=@/path/to/your/image.png;type=image/png' \
    -F username=1a339c02-404a-4b66-9fbb-cb30fb417c14 \
    -F 'password=knwAAOfLBcnkWzGxo0G/ZUzq9ukLb+gf5H/1nmPr7BE+im03qZarW4TvwVepYmi/cg9dEw+N4HDfLqQRfXBSdNawy7YkOQgwOYiRRq3t2PSjYd+Pme4SrMWUE1BYW5rt' \
    -F 'description=Image #1'

We got the result:

{"return": {"success": {"path": "/serve/image/1/97583609772e46729c2646c6fbfdef51.jpg"}}}

You can go to http://image.local-domain:5000/serve/image/1/97583609772e46729c2646c6fbfdef51.jpg to see your image.

History

0.0.2 (Nov 13th, 2017)

  • Support for problem with MySQL/MariaDB and utf8_bin collation

  • Update API for adding image description

  • Update document

  • Add Flask-Cors

  • Include init.d script for Debian

0.0.1 (Nov 11th, 2017)

  • 0.0.1b1: Update document to display in pypi

  • 0.0.1b0: Include document to the package

  • Create, select, update user via command

  • REST API to upload files

  • Serving image via URLs

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ImageButler-0.0.2.tar.gz (10.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ImageButler-0.0.2-py3-none-any.whl (13.4 kB view details)

Uploaded Python 3

File details

Details for the file ImageButler-0.0.2.tar.gz.

File metadata

  • Download URL: ImageButler-0.0.2.tar.gz
  • Upload date:
  • Size: 10.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for ImageButler-0.0.2.tar.gz
Algorithm Hash digest
SHA256 fff0474c3676aac53f2ce4d08dd9e69c182dde65985f51186ffd4dfff4dff413
MD5 34f8c5bf7f8683a68c96c8d75b604ce9
BLAKE2b-256 7c581ffbdb254c3de5ff14b020ca4eea748f395eaaa9439470a9e6d10759a901

See more details on using hashes here.

File details

Details for the file ImageButler-0.0.2-py3-none-any.whl.

File metadata

File hashes

Hashes for ImageButler-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 3214c5a8a785ccc7de793064daf8ae5e6dc4acd3871ffb264df819694f749815
MD5 a5dfd4841e762cdc647b8644882897dd
BLAKE2b-256 4beea81fa65435f660c346b0f2910614289b2b8de19d43a59cfdba85e971ca2f

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page