O'Reilly logo

Google Cloud Platform Cookbook by Legorie Rajan PS

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

How to do it...

The steps involved are as follows:

  1. Navigate to the Chapter02/imageresize folder. 
  2. The package.json file contains the necessary models for our Node.js Cloud Function.
  3. The config.json file contains the dimensions for the resizing to three different form factors.
  4. The following Node.js code is triggered whenever a file is uploaded to a bucket specified during the function creation. It performs the following functions:
    • If the uploaded image is not an image, no action is performed
    • If the image name starts with CR_, then the file is ignored as it has already been resized by this function
    • Deletion and metadata change events are ignored
    • The image file which is to be modified is resized to three different sizes using the sharp module  ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required