Listening to new objects added to GCS and properly resize images based on given dimensions if needed.
This package is specifically prepared to be deployed on GCF using Pub/Sub triggers. It works hand in hand with @pozible/signed-upload to prepare the metadata and upload the file to GCS bucket.
Write index.js
as follows:
exports.service = require('@pozible/image-processor').default;
Then deploy with:
gcloud beta functions deploy image-processor --entry-point=service --source . --memory=256MB --trigger-bucket <bucket-name> --runtime nodejs10