-
Notifications
You must be signed in to change notification settings - Fork 15
Unable to generate images in webP format #32
Description
I followed the steps from https://market.strapi.io/plugins/strapi-plugin-image-optimizer#
I am done with following code changes
package.json
"dependencies": {
"@retikolo/drag-drop-content-types": "^1.3.9",
"@strapi/plugin-documentation": "^4.12.5",
"@strapi/plugin-graphql": "^4.12.5",
"@strapi/plugin-i18n": "^4.12.5",
"@strapi/plugin-users-permissions": "^4.12.5",
"@strapi/provider-upload-aws-s3": "^4.12.5",
"@strapi/strapi": "^4.12.5",
"pg": "^8.11.3",
"react-dom": "^18.2.0",
"request": "2.88.2",
"strapi-plugin-image-optimizer": "^2.1.1",
"strapi-plugin-import-export-entries": "^1.21.1",
"strapi-plugin-multi-select": "^1.2.2",
"strapi-plugin-populate-deep": "^3.0.0"
},
======Plugin.js=========
const { join } = require("node:path");
module.exports = ({ env }) => ({
upload: {
config: {
provider: "aws-s3",
providerOptions: {
rootPath: 'cms',
s3Options: {
accessKeyId: env("AWS_ACCESS_KEY_ID"),
secretAccessKey: env("AWS_ACCESS_SECRET"),
region: env("AWS_REGION"),
params: {
Bucket: env("AWS_BUCKET"),
},
},
},
actionOptions: {
upload: {},
uploadStream: {},
delete: {},
},
},
},
'image-optimizer': {
enabled: true,
config: {
include: ["jpeg", "jpg", "png"],
formats: ["original", "webp",],
sizes: [
{
name: "thumbnail",
width: 800,
},
{
name: "original",
},
],
},
},
});
src/extensions/upload/strapi-server.ts
import imageOptimizerService from "strapi-plugin-image-optimizer/dist/server/services/image-optimizer-service";
module.exports = (plugin) => {
plugin.services["image-manipulation"] = imageOptimizerService;
return plugin;
};
I uploaded images , but images not get converted to desired format
Please suggest , Anything wrong in the code
I having doubt related to src/extensions/upload/strapi-server.ts .. this should be .js/.ts