How to compile PHP with support for webp in gd?

Started by ring_c, June 03, 2019, 08:18:26 PM

Previous topic - Next topic

ring_c

I'v already installed it using:
yum install libwebp-devel
But how can I compile php-fpm with it?

ring_c

I really need to know how to have webp support with gd extension. please!

GTMAN

What do you mean support it? Do you mean to convert images or support displaying them on a website?

evansa

What is the particular extension you want to enable in php?

ring_c

Guys,


I'm hosting Wordpress sites, and recently there are plugins like "Webp express" that can convert standard images (like jpg, png) to webp format for better loading times.


When installing webp express plugin, I'm shown none of the possibilites to convert the images are available, as can be seen here:
https://pasteboard.co/Ii5Nbkt.jpg


I've tried the same plugin on another server I have, running on ispconfig (which I consider as much more primitive comparing to CWP), and there it supports gd out of the box.


So yeah... I'm looking for a way to add --with-webp to the php compiler (it's possible to add such options in php selector, but I don't think it influences php-fpm which I'm using).


Here's a reference to PHP's manual:
https://www.php.net/manual/en/function.imagewebp.php

ed44rf

hi
how enable wepb support in php?
gd -> WebP Support -> enabled

ed44rf

it looks php-fpm not have webp
how  enable it?

ed44rf

here is solution
1 install libwebp
2 edit php config build file /usr/local/cwpsrv/htdocs/resources/conf/php-fpm_selector/7.1.ini  or use any php version
3 add in bottom
[webp]
default=1
option="--with-webp-dir=/usr/lib64/"

4 rebuild php

ring_c

#8
Quote from: ed44rf on June 10, 2019, 09:57:37 AM
here is solution
1 install libwebp
2 edit php config build file /usr/local/cwpsrv/htdocs/resources/conf/php-fpm_selector/7.1.ini  or use any php version
3 add in bottom
[webp]
default=1
option="--with-webp-dir=/usr/lib64/"

4 rebuild php

Thank you, but unfortunately, it's not working (already compiled twice).




ring_c


ring_c

This one kills me... Why can't we get instructions on how to compile PHP with WEBP support?!

Rug3r

Hey ring,

I know this isnt the answer but I am using the ShortPixel Adaptive Image plugin on all my wordpress sites and they are being served as webp. AppSumo had a great deal for them recently and I purchased a couple of codes for it but when I checked today, the deal had expired. I believe they have a free version but not sure if you would be able to auto use their CDN.

ring_c

Quote from: Rug3r on June 22, 2019, 07:47:52 PM
Hey ring,

I know this isnt the answer but I am using the ShortPixel Adaptive Image plugin on all my wordpress sites and they are being served as webp. AppSumo had a great deal for them recently and I purchased a couple of codes for it but when I checked today, the deal had expired. I believe they have a free version but not sure if you would be able to auto use their CDN.
Funny, that's exactly why I'm asking for webp support. I bought this great deal from AppSumo as well, and although I've marked in its settings to use webp, I'm still getting JPGs. I thought it had to do with my setup.
But coming to think about it, as they're being served from their CDN, why would I still get JPGs? Weird...


But anyway, I host other sites for my clients, and I would like to support WebP for them.

r10077

This works for me.
As ed44rf write above,
1. install libwebp
2. edit PHP config build file /usr/local/cwpsrv/htdocs/resources/conf/php-fpm_selector/7.1.ini  or use any PHP version
3. Add this somewhere after [gd-...]

[gd-webp]
default="1"
option="--with-webp-dir=/usr --enable-gd-webp"
info-file="gd.txt"

4 rebuild php

Rug3r

Quote from: ring_c on June 23, 2019, 05:43:16 AM
Quote from: Rug3r on June 22, 2019, 07:47:52 PM
Hey ring,

I know this isnt the answer but I am using the ShortPixel Adaptive Image plugin on all my wordpress sites and they are being served as webp. AppSumo had a great deal for them recently and I purchased a couple of codes for it but when I checked today, the deal had expired. I believe they have a free version but not sure if you would be able to auto use their CDN.
Funny, that's exactly why I'm asking for webp support. I bought this great deal from AppSumo as well, and although I've marked in its settings to use webp, I'm still getting JPGs. I thought it had to do with my setup.
But coming to think about it, as they're being served from their CDN, why would I still get JPGs? Weird...


But anyway, I host other sites for my clients, and I would like to support WebP for them.

Sorry for getting back to you so late. When I right click one of the images and open in a new tab it will look something like this:
https://cdn.shortpixel.ai/spai/w_535+q_lossy+ret_img+to_webp/https://3rdcoastdomains.net/wp-content/uploads/1X_Hosting_Illustration_01.png

At first I was thinking it was still in .png format but when you right click the image and save image as it will show as:
1X_Hosting_Illustration_01.webp

Is that what you were seeing?