S
S
siroper2021-04-10 16:09:59
PHP
siroper, 2021-04-10 16:09:59

Why does the site give krakozyabry instead of webp via a direct link?

Hello. On the site, the php gd image handler creates a webp.

imageCreateFromJpeg(); (или imageCreateFromPng / imageCreateFromGif в зависимости от исходного файла)
imageWebp();


Images on the site are displayed correctly, everything is displayed.
But when you open the photo via a direct link, this is the situation:
6071a35f86517279756136.jpeg

Answer the question

In order to leave comments, you need to log in

2 answer(s)
D
Denis Yuriev, 2021-04-10
@siroper

header('Content-Type: image/webp');
stick before the output
PS: GD disgustingly generates WEBP, imagick is better or vips is even better

S
SagePtr, 2021-04-10
@SagePtr

The web server has no mime-type configured for webp, add to the config

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question