Skip to content

Latest commit

 

History

History
37 lines (22 loc) · 1.02 KB

README.md

File metadata and controls

37 lines (22 loc) · 1.02 KB

Simple Image Cache

Small flask App that processes and caches images from a given URL using Open CV and Redis.

The image can exist either within the chosen image directory configured in the env variables or can be fetched from a remote URL.

WARNING: This is only a proof of concept, use at your own risk.

Usage:

    <img class="testImage" alt="image.jpg"
         src="http://127.0.0.1:8000/insecure/rs:500:500/c:200:200:200:200/ft:png/cp:40/test_image.jpeg">

    <img class="testImage" alt="image.jpg"
         src="http://127.0.0.1:8000/insecure/rs:400:400/ft:jpg/cp:90/https://images.pexels.com/photos/1330219/pexels-photo-1330219.jpeg">

Four operations are supported:

  1. resize; rs: width:height
  2. crop; c: x:y:width:height
  3. format; ft: jpg|png|webp
  4. compression; cp: 0-100

Installation

Add and configure a .env file with the following variables:

CACHE_DIR="/PATH/NAME_OF_CACHE_DIR"
IMAGE_DIR="/PATH/NAME_OF_SRC_IMAGE_DIR"
IMAGE_FORMAT_DEFAULT="webp"
IMAGE_QUALITY_DEFAULT="80"