Newlyweds Proposing Marriage
    Have ideas to improve npm?Join in the discussion! »

    @sankei-arc-shared-components/transform_image-resizer

    0.1.0 • Public • Published

    Generate Image Resizer Function

    How do I use it?

    This functions takes sizePresets and returns a function which returns resizedUrls that use thumbor to do the resizing under the hood.

    Here's an example of how to use the function to generate these urls:

    import generateResizerFunction from '"@sankei-arc-shared-components/transform_image-resizer';
     
    const RESIZER_URL = 'http://example-resizer-url.com';
    const RESIZER_KEY = 'RESIZER_SECRET_KEY';
    const sizePresets = {
      small: { width: 200, height: 200 },
      medium: { width: 600, height: 600 },
      large: { width: 1200, height: 1200 },
    };
    const resizerCriteria = [
      [
        { type: 'image' },
        'url',
      ],
    ];
     
    const resizedUrls = generateResizerFunction(RESIZER_URL, RESIZER_KEY, sizePresets, resizerCriteria);
    const images = [{ type: 'image', url: 'www.image.jpg' }, { type: 'image', url: 'www.image2.jpg' }];
     
    resizedUrls(images); // This will returned resizedUrls for those images

    Keywords

    none

    Install

    npm i @sankei-arc-shared-components/transform_image-resizer

    DownloadsWeekly Downloads

    54

    Version

    0.1.0

    License

    ISC

    Unpacked Size

    42 kB

    Total Files

    6

    Last publish

    Collaborators

    • avatar