php webp安装布署
webp 源码下载:http://down.51cto.com/data/985211
依赖包
libwebp
jpeg-8d
libpng-1.6.2
###################################
webp INSTALL
/usr/local/php-5.3/bin/phpize
./configure --with-php-config=/usr/local/php-5.3/bin/php-config
make
sudo make install
============================
webp.so目录
/usr/lib64/php/modules
webp.ini
/etc/php.d/
php -m
======================
dependency
libwebp-0.3.0+
libjpeg-8+
libpng
======================
demo:
$opts = getopt('f:');
$blob = file_get_contents("/home/lvbenwei/".$opts['f']);
$arg_quality = 80; /** 修改源码,新加入质量参数 **/
$res = image2webp($blob, $arg_quality);
$arr = explode('/',$opts['f']);
file_put_contents("/home/lvbenwei/".$arr[count($arr)-1].".webp",$res);
?>