imgsquash

Simple image compression full website code written in node, react and next.js framework. Easy to deploy as a microservice.

Github星跟踪图

SUMMARY

Image compression full stack website code. Contains both api service and frontend written in node, react and next.js framework.

SCREENSHOTS



SETTING UP GOOGLE CLOUD STORAGE

  1. Create a project on google cloud and add a free cloud storage bucket via this quickstart guide:
  2. Authenticate using either gcloud command line tool (download here) or set GOOGLE_APPLICATION_CREDENTIALS env variable with the service account file.

STARTING THE API SERVICE

  1. Create .env file in the root of the folder with the following variables. See dotenv on how to add env variables.
    • API_VERSION : 1 (optional).
    • GC_STORAGE : your-google-cloud-bucket-name
    • DL_BASE_URL : [YOUR-API-URL]/1/dl
  2. Do npm install to install all node modules for api.
  3. Do npm run dev to start the dev server on 3000 port.
  4. Do npm start for production

STARTING THE FRONTEND

  1. Do npm install to install all node modules for frontend.
  2. Do npm run dev will start the webpack server on 3001 port.
  3. Do npm run build and npm start to build and use the code in production.

NOTES

  1. Following programs are used for optimization

    • mozjpeg (lossy jpeg compression)
    • jpegtran (lossless jpeg compression)
    • pngquant (lossy png compression)
    • optipng (lossless png compression)
  2. Current file size upload limit is 10MB.

  3. API Routes.
    [POST]

    • /image: upload image(s) via file, URL, base64 or Binary.
      • file: file or base64 or binary.
      • lossy: Boolean (default: false)
    • /url: Compression direct image url.
      • url: valid image url.
    • /zip: Accepts list of files object as an array with (id, size and name) and send the zipped result.
      • files: list of files object as an array.

    [GET]
    - /dl/:id: Generate download url of compressed image. Accept optional query name.

LICENSE

MIT

主要指标

概览
名称与所有者eashish93/imgsquash
主编程语言JavaScript
编程语言JavaScript (语言数: 1)
平台
许可证MIT License
所有者活动
创建于2019-05-27 18:20:08
推送于2020-07-17 03:11:12
最后一次提交2019-11-03 18:52:34
发布数0
用户参与
星数1k
关注者数11
派生数66
提交数14
已启用问题?
问题数7
打开的问题数1
拉请求数5
打开的拉请求数6
关闭的拉请求数2
项目设置
已启用Wiki?
已存档?
是复刻?
已锁定?
是镜像?
是私有?