Giter Club home page Giter Club logo

image_processing_api's Introduction

image_processing_api

The Image Processing API can be used in 2 ways:

  1. It will provide a URL to an image the user has saved on disk with the desired image size set by URL parameters. This link can then be used on the frontend for rapid prototyping.
  2. It will function as a library serving appropriatley scaled images to the frontend, eliminating the need to upload and store multiple image files withing a client codebase.

How to use this API:

  1. run the API:
  • clone the project repo.
  • navigate to the root.
  • install dependencies:
npm install
  • start the application:
npm run start

This will create a full directory at the root of the repo if it doesnt already exist and start the application.

  • the main API rout can then be accessed at localhost:3000/api
  1. Upload images:
  • Upload any fullsize .jpg images you wish to resize to the full directory. (the api currently only supports a .jpg extension.)
  1. Resize an image:
  • access the URL: localhost:3000/api/images/?filename={filename.jpg}&height={px}&width={px}; supplying the desired image filename, width and height.
  • the resized image will be served to the above URL.
  • the resized image will also be saved to a thumbs directory at the root of the repository according to the following convention: */thumbs/{width}-{height}-{filename}

Build:

  1. To build and compile to JS, run the following command:
npm run build
  1. To run the application from the build folder:
  • navigate to build/src
  • run the following command to start the application:
node .
  1. Create a full directory. This can be done by either:
  • copying the existing full directory from the project root by running:
npm run copy:images
  • creating the directory manually and uploading desired .jpg fullsize files.
  1. Resize an image running compiled code:
  • Navigate to build/src
  • Run the following command:
node .
  • access the URL: localhost:3000/api/images/?filename={filename.jpg}&height={px}&width={px}; supplying the desired image filename, width and height.

Testing:

  1. Run the test suite with the following command:
npm run test

  • note: currently, running the test suite will delete existing build/full and build/thumbs directories and contents
  1. Run the linter with the following command:
npm run lint
  • note: currently, the following directories are excluded from linting:
    • src/tests/assets
    • src/tests/helpers

Improvements

  • make the following features configurable for the user:
    • location of full/thumbs directories
    • naming convention for resized images
  • create a frontend client to:
    • display available images in a gallery
    • upload images

image_processing_api's People

Contributors

sarnickaa 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.