Skip to content

Releases: kriasoft/image-resizing

Cloud Image Resizing v0.1.2

04 Oct 12:24
2d08adc
Compare
Choose a tag to compare

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

25 Sep 08:35
c3860ab
Compare
Choose a tag to compare

https://example.com/image.jpg (original 1024x576)

image

https://example.com/x_260,y_160,w_120,h_80,c_crop/image.jpg (cropped to 120x80 at 260,160 offset)

image

Cloud Image Resizing v0.1.0

23 Sep 17:42
Compare
Choose a tag to compare

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.