Go straight to the Github Repo
The need to properly size and optimize images within web and app content is such a common problem that th...
For further actions, you may consider blocking this person and/or reporting abuse
Hey thank you so much the solution is flawless. one think i want to know is how does is serve the .webp, if i request my images like this my.service.url/myphoto.png?w=800, how does the .webp served.
Thanks for the praise, and you're welcome!
Two things work together to return WebP.
First, I check the "Accepts" header of the http request, which automatically gets sent by all browsers. If "webp" is in the value of that header, I know the client can accept webp format.
Second, I'm using the
sharpnpm package to manipulate the images. Sharp can create WebP images from source images.And that's it. Glad you like the solution.
Thanks for a quick reply.
I am facing the following an Error if the image is not in the bucket root,
Example: original URL: distribution/uploads/test.jpeg?w=200
Error message: "Error while getting source image object "/uploadstest.jpeg": NoSuchKey: The specified key does not exist"
If the image is in the subfolder I get the following error how can if ix it.
Ah, looks like a bug in appending the prefix ( a missing / character). I'll push a fix in about an hour.
yah it took me long to realize that a / was missing please du push the fix.
I fixed the bug. You'll just need to
git pullandnpm run update [env].Hie the solution is working great but rather i noted a huge grow on my page size after inspecting thoroughly i found out that if i upload a jpeg with 1200x800 size 88kb. If i then try to resize it to ?w=500 the size actually grows from 88kb to 265kb when it supposed to have gone down. i tried to change the sharp quality to as less a 50 but did not change a thing. thank you bro please look into it.
Hello there. I can't, I can't figure out how to install it. is there any video. Please