Upload webp wrapper
Strapi wrapper to convert image files to webp for any upload provider.
strapi-provider-upload-webp-wrapper
How it's works
This provider only create a wrapper between the uploaded file and another provider, this wrapper convert the image files to webp and then delivery it to the actual provider.
Requirements
Strapi > v5.0.0
Installation
# using yarn
yarn add strapi-provider-upload-webp-wrapper
# using npm
npm install strapi-provider-upload-webp-wrapper --save
# using pnpm
pnpm add strapi-provider-upload-webp-wrapperConfiguration
providerdefines the name of the provider, in this casestrapi-provider-upload-webp-wrapperproviderOptions.mimeTypesThe mime types that will be converted to webp. if not provide the following formats will be accepted.['image/png', 'image/jpeg', 'image/jpg']providerOptions.sharpOptionsSharp options: See optionsproviderOptions.redirectis the configuration passed down to the effective provider.
See the documentation about using a provider for information on installing and using a provider. To understand how environment variables are used in Strapi, please refer to the documentation about environment variables.
Provider Configuration
./config/plugins.js or ./config/plugins.ts for TypeScript projects:
1module.exports = ({ env }) => ({
2 // ...
3 upload: {
4 config: {
5 provider: "strapi-provider-upload-webp-wrapper",
6 providerOptions: {
7 mimeTypes: ['image/png', 'image/jpeg', 'image/jpg'],
8 sharpOptions: {
9 quality: 50,
10 smartSubsample: true
11 },
12 redirect: {
13 provider: 'local',
14 providerOptions: { sizeLimit: 2 * 1000 * 1000 }
15 }
16 }
17 },
18 },
19 // ...
20});This configuration convert the requested mime types to wepb and delivery it to the local provider to be stored.
Install now
npm install strapi-provider-upload-webp-wrapper
Create your own plugin
Check out the available plugin resources that will help you to develop your plugin or provider and get it listed on the marketplace.