Giter VIP home page Giter VIP logo

fastphotoapi's Introduction

FastPhotoAPI

An efficient, flexible, flask-based image server that uses lanczos resampling to serve optimized cached photos.

python3.12 -m venv fast_photo_venv
source fast_photo_venv/bin/activate
pip install -r requirements.txt

Usage:

  • Fetch a resampled & cached image /image/<yourimage>
  • Fetch the original, unmodified image /full/<yourimage>

Structure:

This application adopts the factory pattern; flask run instantiates the built-in development server by executing create_app() at the root of the app/ package, while python application.py creates a new production application, served by waitress.

.
├── app
          ├── __init__.py  #  create and serve development application
          └── main
              ├── config
│             │         └── config.cfg  # set directories, max image dimensions, etc
│             ├── fullsize
│             │         └── routes.py  # Blueprint routing for serving verbatim image files 
│             ├── __init__.py  # `create_app()` entrypoint
│             ├── resampled
│             │         ├── model.py  # Image resampling methods
│             │         └── routes.py  # Blueprint routing for `/image/`  
│             └── static
│                 └── routes.py  # Blueprint routing for `/static/` 
├── application.py  # create and serve production application w/ waitress
├── cache  # resampled images are dynamically generated adn stored here 
├── Dockerfile  # currently deployed at Koyeb  
├── pictures # full res pictures go here
├── README.md  # you are here
├── static
│         └── style.css  # index styling
└── templates
    ├── index.html  
    └── upload.html

Build

Locally:

flask run # 0.0.0.0:5000
flask run # 0.0.0.0:8000

Production via Docker:

## build production docker image:
docker build -t <srv> .

## serve production docker image locally:
docker run -d -p 8000:8000 <srv>:latest

## stop local image:
# docker ps
# docker stop 

## push image to a container registery: 
# docker push <srv>

fastphotoapi's People

Contributors

jesssullivan avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.