Skip to content

file Upload using NodeJS & ExpressJS With Sharp for Image Resizing & Formatting

Notifications You must be signed in to change notification settings

mahmoud-bebars/file-proccessor

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Cropping & Resizing App

using Nodejs & Express With Sharp

we can upload the photo & make some Image Processing on it Like Resizing it to specefic Size & Sharp giving us this Ablity

Also to save some server Storage we Are converting the image to Webp using Sharp after resizing & cropping it to the center of the iamge using equation :

  • meta.height / 2 - height / 2 ---> for the x-axis
  • meta.width/ 2 - width / 2 ---> for the y-axis.

used Techs

  • NodeJS
  • ExpressJS
  • Sharp
  • Formidable
  • Nodemon

Avilable Scripts

    "start": "node server.js",
    "dev": "nodemon server.js"

Availavble Routes

  • /api/upload - POST - Method -FormData

= data Sent in the form

  • file with feild name image
  • JSON stringfy Object with Feild name imgSettings
  • if used in postman no stringfy function needed
  • if in App like React App - pass the Data object in the JSON.Stringfy function
  • object example :
 ` {
     "width":200,
     "height":200,
     "name":"testing",
     "format":"webp"
   }

Explore in The following Techs For more tricks in Image Processing

for more Info About Image uploading & methods to use

About

file Upload using NodeJS & ExpressJS With Sharp for Image Resizing & Formatting

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published