weserv / images

Source code of wsrv.nl (formerly images.weserv.nl), to be used on your own server(s).
https://wsrv.nl/
BSD 3-Clause "New" or "Revised" License
1.84k stars 187 forks source link

webp not right format #349

Closed kesar closed 1 year ago

kesar commented 2 years ago

Hi, we are getting issues loading a webp image, isnt supported? docs says that webp should be fine.

Thanks!

image

https://everipedia-storage.s3.amazonaws.com/ProfilePicture/lang_en/pickle-finance-cryptocurrency/mainphoto_medium.webp

https://images.weserv.nl/?url=https://everipedia-storage.s3.amazonaws.com/ProfilePicture/lang_en/pickle-finance-cryptocurrency/mainphoto_medium.webp

kleisauke commented 2 years ago

It looks like this WebP image is uploaded gzip-compressed to Amazon S3.

$ curl -s -D - -o /dev/null https://everipedia-storage.s3.amazonaws.com/ProfilePicture/lang_en/pickle-finance-cryptocurrency/mainphoto_medium.webp | grep "Content-Encoding"
Content-Encoding: gzip
$ curl -H "Accept-Encoding: identity" -s -D - -o /dev/null https://everipedia-storage.s3.amazonaws.com/ProfilePicture/lang_en/pickle-finance-cryptocurrency/mainphoto_medium.webp | grep "Content-Encoding"
Content-Encoding: gzip

Our requests are sent without the Accept-Encoding header, which implies that we want the default encoding, i.e. identity. The caveat here is that the RFC2616 sec 14.3 allows the server to assume any available encoding is acceptable.

We only support gzip-compressed SVG images (i.e. *.svgz and *.svg.gz), there's no plan to support other gzip-compressed images. Note that it's recommended to not use gzip for images or other binary files, as they are already compressed; using gzip on them won't provide any additional benefit, and can actually make them larger.

kleisauke commented 1 year ago

I hope this information helped. Please feel free to re-open if questions remain.