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:
module.exports = ({ env }) => ({
// ...
upload: {
config: {
provider: "strapi-provider-upload-webp-wrapper",
providerOptions: {
mimeTypes: ['image/png', 'image/jpeg', 'image/jpg'],
sharpOptions: {
quality: 50,
smartSubsample: true
},
redirect: {
provider: 'local',
providerOptions: { sizeLimit: 2 * 1000 * 1000 }
}
}
},
},
// ...
});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.