Skip to content

Eslam-Gaber645/-Udacity--Image-processing-API

Repository files navigation

(Udacity) Image Processing API

This project is for the Advanced Full-Stack Web Development track provided by Udacity.

It is a service to resize images with the desired dimensions and save them as a cache to be reused upon request again.

Tech Stack

  • Server
    • Node
    • Express
    • Sharp
  • Development
    • Typescript
    • Eslint
    • Prettier
    • Jasmine
    • Supertest

Installation

Clone the project

  git clone https://github.com/Eslam-Gaber645/-Udacity--Image-processing-API.git

Go to the project directory

  cd ./-Udacity--Image-processing-API

Install dependencies

  npm i

Build project

  npm run build

Running Server

To run the server, run the following command

  npm run start

Now the server is running on port 3000!.

Running Tests

To run tests, run the following command

  npm run test

All NPM Tasks

Task Action Note
clean Remove build directory .
build Build the app uses the clean tasks.
start Start the server You have to build the app first.
start:dev Start the dev server .
jasmine Run jasmine tests You have to build the app first.
test Build app and run tests uses the build task.
prettier Prettify source code .
lint Linting source code .
lint:fix Linting and fix source code .

API Reference

Description page:-

  GET /

Get image:-

  GET /image?filename=${imageName}&width=${width}&height=${height}
Parameter Type Description
imageName string Required. Target image name
width integer Optional. Pixel numeric value
height integer Optional. Pixel numeric value

Environment Variables

You can change the following environment variables in .env file.

  • PORT : The server port.

  • ORIGINAL_IMAGES_DIR : The original images directory.

  • THUMB_IMAGES_DIR : The resized images directory.

Notes

-If width and height are not defined or are not valid values, then the original image will be sent without resizing.

-If only width or height is defined with a valid value, the other dimension of the image will be scaled based on the aspect ratio of the original image.

-You can resize any image with any extension.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published