Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[img] Cloud image resizing (GCF) #284

Merged
merged 1 commit into from
Feb 25, 2021
Merged

[img] Cloud image resizing (GCF) #284

merged 1 commit into from
Feb 25, 2021

Conversation

koistya
Copy link
Member

@koistya koistya commented Feb 25, 2021

This cloud function is intended to be used for image resizing and optimization
needs as a light and cheaper alternative to 3rd party services. See img package.

const { createHandler } = require("image-resizing");

/**
 * Dynamic image resizing. Usage example:
 *
 *   https://example.com/img/image.jpg - original image
 *   https://example.com/img/w_60,h_80/image.jpg - 60x80 thumbnail
 *
 * @see https://github.com/kriasoft/image-resizing
 */
module.exports.img = createHandler({
  // Where the source images are located.
  // E.g. gs://s.example.com/image.jpg
  sourceBucket: process.env.SOURCE_BUCKET,

  // Where the transformed images needs to be stored.
  // E.g. gs://c.example.com/image__w_80,h_60.jpg
  cacheBucket: process.env.CACHE_BUCKET,
});

How to Deploy

Ensure that the source and cache GCS bucket exist, then run:

$ yarn img:deploy [--env #0]

@koistya koistya self-assigned this Feb 25, 2021
@koistya koistya force-pushed the image-resizing branch 5 times, most recently from fce4b97 to d07a025 Compare February 25, 2021 08:59
@koistya koistya merged commit 2038087 into main Feb 25, 2021
@koistya koistya deleted the image-resizing branch February 25, 2021 09:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant