Skip to content
Image resize using sharp library and Google cloud functions, which uploads the image back to google cloud bucket.
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.gcloudignore
.gitignore
MIT-LICENSE
README.md
index.js
package-lock.json
package.json

README.md

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
You can’t perform that action at this time.