
Product
Socket Now Protects the Chrome Extension Ecosystem
Socket is launching experimental protection for Chrome extensions, scanning for malware and risky permissions to prevent silent supply chain attacks.
strapi-provider-upload-aws-s3-seo
Advanced tools
Strapi CMS: AWS S3 upload provider with image resizing, conversion (avif, webp, jpg, png) and optimization
This is a custom (thebootcode.io SEO-Version) Strapi upload provider extension for Amazon S3. It provides additional functionality for processing images, including resizing to various sizes and converting them into multiple formats with format-specific options using sharp.js.
Install the package directly from NPM:
npm i strapi-provider-upload-aws-s3-seo
Update your Strapi (>= 4.0.0) config/plugins.js
file with the following configuration:
module.exports = ({ env }) => ({
upload: {
config: {
provider: 'strapi-provider-upload-aws-s3-seo',
providerOptions: {
baseUrl: env('CDN_URL'),
rootPath: env('CDN_ROOT_PATH'),
s3Options: {
credentials: {
accessKeyId: env('AWS_ACCESS_KEY_ID'),
secretAccessKey: env('AWS_ACCESS_SECRET'),
},
region: env('AWS_REGION'),
params: {
ACL: env('AWS_ACL', 'public-read'),
signedUrlExpires: env('AWS_SIGNED_URL_EXPIRES', 15 * 60),
Bucket: env('AWS_BUCKET'),
},
},
formats: [
{ name: 'webp', options: { quality: 80 } }, // WebP with quality 80
{ name: 'avif', options: { quality: 60 } }, // AVIF with quality 60
{ name: 'jpg', options: { quality: 90 } }, // JPG with quality 90
],
sizes: [
{ name: 'thumbnail', width: 96 },
{ name: 'small', width: 300 },
{ name: 'medium', width: 960 },
{ name: 'large', width: 1920 },
],
},
},
},
});
Find more AWS-specific options here.
To allow the thumbnails to properly populate, update also your Strapi (>= 4.0.0) config/middleware.js
file with the following configuration:
module.exports = ({ env }) => [
// ...
{
name: "strapi::security",
config: {
contentSecurityPolicy: {
useDefaults: true,
directives: {
"connect-src": ["'self'", "https:"],
"img-src": ["'self'", "data:", "blob:", `${env("CDN_URL")}`],
"media-src": ["'self'", "data:", "blob:", `${env("CDN_URL")}`],
upgradeInsecureRequests: null,
},
},
},
},
// ...
];
Restart your Strapi server to apply the changes:
npm run develop
The formats
option is an array of objects. Each object defines:
name
: The format name (e.g., webp
, avif
, jpg
, png
).options
: Format-specific options (e.g., quality
, lossless
).Example:
formats: [
{ name: 'webp', options: { quality: 80 } },
{ name: 'avif', options: { quality: 60 } },
{ name: 'jpg', options: { quality: 90 } },
]
Find more Sharp-specific options here.
The sizes
option is an array of objects. Each object defines:
name
: A unique name for the size (e.g., thumbnail
, small
).width
: The width of the resized image in pixels.Example:
sizes: [
{ name: 'thumbnail', width: 96 },
{ name: 'small', width: 300 },
{ name: 'medium', width: 960 },
{ name: 'large', width: 1920 },
]
When an image is uploaded:
<imageName>_<sizeName>.<format>
.file.formats
.Given the following configuration:
formats: [
{ name: 'webp', options: { quality: 80 } },
{ name: 'jpg', options: { quality: 90 } }
],
sizes: [
{ name: 'thumbnail', width: 96 },
{ name: 'medium', width: 960 }
]
For an image image123.png
, the following files will be uploaded to S3:
image123_thumbnail.webp
image123_thumbnail.jpg
image123_medium.webp
image123_medium.jpg
...
image123.png (original)
When a file is deleted via Strapi, all its variants (original, resized, converted) are deleted from S3.
This project is licensed under the ISC License.
FAQs
Strapi CMS: AWS S3 upload provider with image resizing, conversion (avif, webp, jpg, png) and optimization
The npm package strapi-provider-upload-aws-s3-seo receives a total of 0 weekly downloads. As such, strapi-provider-upload-aws-s3-seo popularity was classified as not popular.
We found that strapi-provider-upload-aws-s3-seo demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Socket is launching experimental protection for Chrome extensions, scanning for malware and risky permissions to prevent silent supply chain attacks.
Product
Add secure dependency scanning to Claude Desktop with Socket MCP, a one-click extension that keeps your coding conversations safe from malicious packages.
Product
Socket now supports Scala and Kotlin, bringing AI-powered threat detection to JVM projects with easy manifest generation and fast, accurate scans.