1.0.3 • Published 3 years ago

@skg-global/sharp_client v1.0.3

Weekly downloads
-
License
ISC
Repository
github
Last release
3 years ago

Install

$ yarn add @skg-global/sharp_client

Client integration

You can be used to generate URLs for images.

import { createClient } from '@skg-global/sharp_client';

const client = createClient('http://example.com/base', 'sample-bucket');

const originalImageUrl = 'demo.png';
const options = {
  resize: { width: 200, fit: 'cover' },
};

const fooUrl = client.url(originalImageUrl, options);
 --> http://example.com/base/eyJidWNrZXQiOiJzYW1wbGUtYnVja2V0Iiwia2V5IjoiZGVtby5qcGVnIiwiZWRpdHMiOnsicmVzaXplIjp7IndpZHRoIjoyMDAsImZpdCI6ImNvdmVyIn19fQ==

Currently the following transformations can be applied to images:

Client option nameQuery param nameDescription
resize.width
resize.height
toFormatOutput image format. Valid values: every valid sharp output format string, i.e. jpeg, gif, webp.
rotateRotate the output image by either an explicit angle or auto-orient based on the EXIF sharp cropping feature.
flipFlip the image about the vertical Y axis sharp flip feature.
flopFlop the image about the vertical X axis sharp flop feature.
smartCrop(optional, object) activates the smart cropping feature for an original image (Amazon Rekognition)
1.0.3

3 years ago

1.0.2

3 years ago