Image resize and upload back to google cloud bucket using Google Cloud functions.
Developed to work with Google Cloud Functions.
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 -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"
Clone the repository on your machine and run
npm install
-
[Install Google Cloud SDK] (https://cloud.google.com/sdk/install)
-
gcloud auth login
gcloud config set project {{PROJECT_NAME}}
gcloud beta functions deploy imageResize --trigger-http
- 0.1.0
- Work in progress
Sunil Shenoy – @ssunil
Distributed under the MIT license. See MIT-LICENSE
for more information.
- Fork it (https://github.com/sunilshenoy/image-resize-googlecloud)
- Create your feature branch (
git checkout -b feature/fooBar
) - Commit your changes (
git commit -am 'Add some fooBar'
) - Push to the branch (
git push origin feature/fooBar
) - Create a new Pull Request