Add WebP support to GD (PHP Module)
In order to clarify the issue I don't have any problem with install PHP with GD enabled but when I want to use imagewebp() I got an error:
After searching about the error I find the problem. I need to install GD --with-vpx-dir=DIR as I see in PHP.net: GD Installing/Configuring I know EasyApache will search for additional GD feature libraries (PHP Module: GD): [LIST]JPEG support > if find > libjpeg.so
PNG support > if find > libpng.so
XPM support > if find > libXpm.so
But what about WebP? is this something like this:
[LIST]
WebP support > if find > libvpx.so
I installed libvpx & libvpx-devel and after that I find libvpx.so as same path as libXpm.so and other *.so than I rebuild EasyApache and I expected see --with-vpx-dir=DIR in my phpinfo()
configure command section, but nothing different and if I use imagewebp() got the error.
Where am I wrong? and how to enable imagewebp() on my server (CentOS 7 - 64bit).
Fatal error: Call to undefined function imagewebp()
After searching about the error I find the problem. I need to install GD --with-vpx-dir=DIR as I see in PHP.net: GD Installing/Configuring I know EasyApache will search for additional GD feature libraries (PHP Module: GD): [LIST]
-
Hello, Could you let us know if the system uses EasyApache 3, or EasyApache 4? With EasyApache 3, you can use raw opts as documented at: Raw Opts - EasyApache - cPanel Documentation Information about an EasyApache 4 equivalent is discussed on the following thread: EA4 equivalent for php rawopts ? Thank you. 0 -
Thanks for useful link. I use EasyApache 3 and PHP 5. So I must create file: /var/cpanel/easy/apache/rawopts/all_php5
with this content:--with-vpx-dir --path-to-vpx-dir=/usr/lib64/libvpx.so --my-option= --with-webp-dir --path-to-webp-dir=/usr/lib64/libwebp.so --my-option=
And than rebuild, is it true?0 -
Hi BoxMan, This *should* work, but attempt it and see how it works. 0 -
thanks, but no change. it's not work for me. I do as I said in last post. 0 -
--with-vpx-dir --path-to-vpx-dir=/usr/lib64/libvpx.so --my-option= --with-webp-dir --path-to-webp-dir=/usr/lib64/libwebp.so --my-option=
Hello, Try using the following entries before running EasyApache again and let us know if it makes a difference:--with-vpx-dir=/usr --with-webp-dir=/usr
Thank you.0 -
hooray !! it's work, really thanks. Codes in box.. ;) 0 -
Hi, I'm getting exactly the same issue as the original poster but using EasyApache 4 / PHP 7.4. I've read the whole of this post, and would like to install GD using the 'with-webp-dir' option so that the imagewebp() function becomes available, but very stuck on how to do this with EasyApache4 (instructions above were for EA3). I've noticed a file called gd.ini inside /opt/cpanel/ea-php74/root/etc/php.d/ but not sure if it's just a case of appending the 'with-webp-dir' option to that file and then re-running EA? (a bit scared of doing this in case i bork the server) (EDIT: I read on another thread that in EA 3 you could create a 'rawopt' file called 'all_php_5' for PHP configuration options, but an 'all_php_7' equivalent doesn't seem to exist in EA 4 so not sure where'd you'd configure the installation of a specific extension?) 0 -
Now rolled my own imagewebp() function as I had a live site that needed the functionality (upgraded a site from an older version of PHP that already had the same function). For anyone else, I installed Google's cwebp library and I'm calling it from PHP (works well enough). [CODE=php]exec('cwebp -q ' . $quality . ' ' . $jpegFileName . ' -o ' . $webpFileName);
(Don't really like relying too much on external libraries, but there doesn't seem much other option here)0
Please sign in to leave a comment.
Comments
8 comments