How to do it...

The steps involved are as follows:

  1. Navigate to the Chapter17/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  ...

Get Building Google Cloud Platform Solutions now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.