Releases: kriasoft/image-resizing
Releases · kriasoft/image-resizing
Cloud Image Resizing v0.1.2
Allow passing folder names as part of sourceBucket
, cacheBucket
settings (see #2).
import { createHandler } from "image-resizing";
export const img = functions.https.onRequest(createHandler({
// Where the source images are located.
// E.g. gs://s.example.com/uploads/image.jpg
sourceBucket: "gs://s.example.com/uploads",
// Where the transformed images needs to be stored.
// E.g. gs://storage.example.com/cache/image__w_80,h_60.jpg
cacheBucket: "gs://s.example.com/cache",
}));
Cloud Image Resizing v0.1.1
Cloud Image Resizing v0.1.0
The initial version that can be hosted as a Google Cloud Function.
https://example.com/image.jpg - the original image
https://example.com/w_100,h_80,c_fill/image.jpg - dynamically transformed image (100x80)
Getting Started
# Using NPM
$ npm install image-resizing --save
# Using Yarn
$ yarn add image-resizing
Create a Google Cloud Function project that exports image transformation HTTP handler:
const { createHandler } = require("image-resizing");
module.exports.img = createHandler({
// Where the source images are located.
// E.g. gs://s.example.com/image.jpg
sourceBucket: "s.example.com",
// Where the transformed images needs to be stored.
// E.g. gs://c.example.com/image__w_80,h_60.jpg
cacheBucket: "c.example.com",
});
Deploy it to GCP using Node.js v12+ runtime and configure a CDN on top of it.