Skip to content

Image resize using sharp library and Google cloud functions, which uploads the image back to google cloud bucket.

License

Notifications You must be signed in to change notification settings

sunilshenoy/image-resize-googlecloud

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

24 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Image Resize / Upload Google Cloud

Image resize and upload back to google cloud bucket using Google Cloud functions.

Developed to work with Google Cloud Functions.

API

Send POST request to your Google Cloud functions HTTP endpoint with these parameters

  • file_location -Remote location of file you want to resize.

  • width - Resize the above image to width.

  • height - Resize the above image to height.

Returns JSON:

   thumbnail: {{Google Cloud signed URL}}

curl example

curl -X "POST" "{{YOUR_GOOGLE_CLOUDFUNCTIONURL}}/imageResize"
-H 'Content-Type: application/x-www-form-urlencoded; charset=utf-8'
--data-urlencode "file_location={{IMAGE_URL_YOU_WANT_TO_RESIZE}}"
--data-urlencode "width=100"
--data-urlencode "height=100"

Development setup

Clone the repository on your machine and run

npm install

Deployment to Google Cloud Function

gcloud config set project {{PROJECT_NAME}}
gcloud beta functions deploy imageResize --trigger-http

Release History

  • 0.1.0
    • Work in progress

Meta

Sunil Shenoy – @ssunil

Distributed under the MIT license. See MIT-LICENSE for more information.

Contributing

  1. Fork it (https://github.com/sunilshenoy/image-resize-googlecloud)
  2. Create your feature branch (git checkout -b feature/fooBar)
  3. Commit your changes (git commit -am 'Add some fooBar')
  4. Push to the branch (git push origin feature/fooBar)
  5. Create a new Pull Request

About

Image resize using sharp library and Google cloud functions, which uploads the image back to google cloud bucket.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published