This simple web application, developed as part of the web technology course (ss2020), allows you to upload and process photos (reduce size and quality, extract a square shape and the primary colors).
This application can be used with or without Docker.
If you don't have Docker installed, install it from here.
- Сlone this repository.
- Open your terminal and cd into the repository directory.
- Run the following commands to start app:
development
# build a image
$ npm run docker-build:dev
# run the image as a container
$ npm run docker-run:dev
production
# build a image
$ npm run docker-build:prod
# run the image as a container
$ npm run docker-run:prod
- Visit your application in a browser at http://localhost:3000/.
- To stop or restart the container run the appropriate command
development
# stop the running container
$ npm run docker-stop:dev
# restart the stopped container
$ npm run docker-start:dev
production
# stop the running container
$ npm run docker-stop:prod
# restart the stopped container
$ npm run docker-start:prod
If you don't have Node.js installed, install it from here. You'll need Node.js version 10.13 or later.
- Сlone this repository.
- Open your terminal and cd into the repository directory.
- Run the following command to set up npm packages:
$ npm install
# start app in development mode
$ nmp run dev
# build app for production usage
$ npm run build
# start production server
$ npm run start
To use already prepared data, replace /upload
with /examples/upload
if you go to http://localhost:3000/api/get/images, you'll get something like
[
{
id: "B1kgzLca_",
name: "bridge",
date: "2020-09-19T21:16:12.200Z",
original: { src: "/api/get/image/original/B1kgzLca_.jpeg" },
scaled: [
{
size: "XS",
width: 200,
height: 200,
src: "/api/get/image/XS/B1kgzLca_.jpeg",
},
{
size: "S",
width: 267,
height: 400,
src: "/api/get/image/S/B1kgzLca_.jpeg",
},
{
size: "M",
width: 467,
height: 700,
src: "/api/get/image/M/B1kgzLca_.jpeg",
},
{
size: "L",
width: 600,
height: 900,
src: "/api/get/image/L/B1kgzLca_.jpeg",
},
],
colors: ["#d3cdc8", "#1e1e21", "#604f4b", "#6f777e", "#846659"],
},
...
]
Use sort
and order
(ascending order by default) to sort returned data.
GET /api/get/images?sort=name
GET /api/get/images?sort=name&order=desc
The following options are available
sort=name
- sort by image name
sort=date
- sort by upload date
sort=color
- sort by main color
sort=random
- sort in random order
order=asc
- arrange in ascending order
order=desc
- arrange in descenting order
Use limit
and page
(limit must be set) to paginate returned data.
GET /api/get/images?limit=10
GET /api/get/images?limit=10&page=5
Before submitting your contribution, please make sure to take a moment and read through the following:
This project was created using JavaScript library React and React Framework Next.js. Make sure you understand the basic concepts of these technologies. In addition, basic knowledge of Tailwindcss and Express is desirable.
In this workflow, we have three branches
- Master branch will have production code only. In other words, anything you push to the master branch better be free of bugs.
- Dev branch will be the "live" version of your software. This is the branch that developers will push to on a regular basis with new features.
- Feature technically is not a single branch. Each feature branch represents a new chunk of code that will eventually be tested and added to the codebase.
The basic steps in this flow are as follows:
- Create a new branch from the dev branch and call it something like "feature-< describe feature here, or give it an ID >"
- Work on your feature, committing to this feature branch
- Test your feature
- Merge your feature into the dev branch
- Delete your feature branch
- Once enough features have been added, prepare your release
- When the release is tested and prepped, merge the dev branch into master
- Tag the master branch commit to the correct version (i.e. v1.1)
- Repeat
This application is MIT licensed.