npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

strapi-provider-upload-aws-s3-with-webp-optimisation

v1.1.1

Published

Optimizes image by using [sharp](https://sharp.pixelplumbing.com/).

Downloads

7

Readme

strapi-provider-upload-aws-s3-with-webp-optimisation

Optimizes image by using sharp.

Also outputs WebP image on upload.

This plugin is tested on strapi with strapi >= 4.0.0.

npm version

Installation

npm install strapi-provider-upload-aws-s3-with-webp-optimisation

or

yarn add strapi-provider-upload-aws-s3-with-webp-optimisation

Configurations

Your configuration is passed down to the provider. (e.g: new AWS.S3(config)).

You can see the complete list of options here.

Example ./config/plugins.js

module.exports = ({ env }) => ({
  upload: {
    config: {
      // Strapi uses the full package name as provider name with strapi >= 4.0.0.
      provider: 'strapi-provider-upload-aws-s3-with-webp-optimisation',
      providerOptions: {
        accessKeyId: env('AWS_ACCESS_KEY_ID'),
        secretAccessKey: env('AWS_ACCESS_SECRET'),
        region: env('AWS_REGION'),
        // Optional: Use CDN URL (e.g: https://xxxxxx.cloudfront.net)
        cdn: env('AWS_CLOUDFRONT'),
        // Optional: File uploaded in images folder (e.g: images/sample.png)
        prefix: 'images',
        params: {
          Bucket: env('AWS_BUCKET'),
        },
        // Optional: Options for output image
        // Images optimised by using sharp.
        // See https://sharp.pixelplumbing.com/api-output
        sharpOptions: {
          jpeg: {
            quality: 90,
            progressive: true,
          },
          png: {
            quality: 90,
            progressive: true,
          },
          webp: {
            alphaQuality: 90,
          },
          tiff: {},
          gif: {}
        }
      }
    },
  },
});

Upload WebP URLs are saved into formats in files table.

You need to Enable responsive friendly upload setting is enabled in the settings panel to generate responsive image sizes.

See webp object in each size object.

{
  "large": {
    "ext": ".png",
    "url": "https://xxxxxx.cloudfront.net/images/large_2000x1000_47fb084046.png",
    "hash": "large_2000x1000_47fb084046",
    "mime": "image/png",
    "name": "large_2000x1000.png",
    "path": null,
    "size": 170.82,
    "webp": {
      "ext": ".webp",
      "url": "https://xxxxxx.cloudfront.net/images/large_2000x1000_47fb084046.webp",
      "hash": "large_2000x1000_47fb084046",
      "mime": "image/webp",
      "name": "large_2000x1000_47fb084046.webp",
      "size": 39.78,
      "width": 1000,
      "height": 500
    },
    "width": 1000,
    "height": 500
  },
  "small": {
    "ext": ".png",
    "url": "https://xxxxxx.cloudfront.net/images/small_2000x1000_47fb084046.png",
    "hash": "small_2000x1000_47fb084046",
    "mime": "image/png",
    "name": "small_2000x1000.png",
    "path": null,
    "size": 55.6,
    "webp": {
      "ext": ".webp",
      "url": "https://xxxxxx.cloudfront.net/images/small_2000x1000_47fb084046.webp",
      "hash": "small_2000x1000_47fb084046",
      "mime": "image/webp",
      "name": "small_2000x1000_47fb084046.webp",
      "size": 17.34,
      "width": 500,
      "height": 250
    },
    "width": 500,
    "height": 250
  },
  "medium": {
    "ext": ".png",
    "url": "https://xxxxxx.cloudfront.net/images/medium_2000x1000_47fb084046.png",
    "hash": "medium_2000x1000_47fb084046",
    "mime": "image/png",
    "name": "medium_2000x1000.png",
    "path": null,
    "size": 107.93,
    "webp": {
      "ext": ".webp",
      "url": "https://xxxxxx.cloudfront.net/images/medium_2000x1000_47fb084046.webp",
      "hash": "medium_2000x1000_47fb084046",
      "mime": "image/webp",
      "name": "medium_2000x1000_47fb084046.webp",
      "size": 28.44,
      "width": 750,
      "height": 375
    },
    "width": 750,
    "height": 375
  },
  "thumbnail": {
    "ext": ".png",
    "url": "https://xxxxxx.cloudfront.net/images/thumbnail_2000x1000_47fb084046.png",
    "hash": "thumbnail_2000x1000_47fb084046",
    "mime": "image/png",
    "name": "thumbnail_2000x1000.png",
    "path": null,
    "size": 17.19,
    "webp": {
      "ext": ".webp",
      "url": "https://xxxxxx.cloudfront.net/images/thumbnail_2000x1000_47fb084046.webp",
      "hash": "thumbnail_2000x1000_47fb084046",
      "mime": "image/webp",
      "name": "thumbnail_2000x1000_47fb084046.webp",
      "size": 6.35,
      "width": 245,
      "height": 122
    },
    "width": 245,
    "height": 122
  }
}