Can also be used the Webp.
In the CENTOS 6.10 it took the following steps:
yum install gcc gcc-c++ kernel-devel
yum install libjpeg-devel libpng-devel libtiff-devel libgif-devel
Have the gcc
, make
and automake
cd /opt
wget https://storage.googleapis.com/downloads.webmproject.org/releases/webp/libwebp-1.0.2.tar.gz
tar xvzf libwebp-1.0.2.tar.gz
cd libwebp-1.0.2
./configure
make
sudo make install
The cwebp and dwebp , were made available in the directory /usr/local/bin/
, to use command in php:
cd /usr/local/bin/
mv cwebp /usr/bin/
mv dwebp /usr/bin/
In the PHP was used the exec:
<?php
$imgName = "php.jpg";
$webPName = "php.webp";
if(file_exists($imgName)){
exec("cwebp -q 80 $imgName -o $webPName");
}
Compiling with other platforms.
Leandro gives a look at the function imagewebp() of own PHP
– Lucas