Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to generate images in webP format #32

Open
sarikajadhavneo opened this issue Nov 23, 2023 · 0 comments
Open

Unable to generate images in webP format #32

sarikajadhavneo opened this issue Nov 23, 2023 · 0 comments

Comments

@sarikajadhavneo
Copy link

sarikajadhavneo commented Nov 23, 2023

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant