|
@@ -259,7 +259,7 @@ class Img
|
|
|
* @desc 对图片进行压缩处理
|
|
|
* @param *
|
|
|
*/
|
|
|
- public function compress($source, $quality = 20, $name = false)
|
|
|
+ public function compress($source, $quality = 75, $name = false)
|
|
|
{
|
|
|
$this->setSource($source);
|
|
|
if (!$this->_image) {
|
|
@@ -275,13 +275,14 @@ class Img
|
|
|
* @desc 对图片进行webp转换
|
|
|
* @param *
|
|
|
*/
|
|
|
- public function webp($source, $name = false)
|
|
|
+ public function webp($source, $quality = 75, $name = false)
|
|
|
{
|
|
|
$this->setSource($source);
|
|
|
if (!$this->_image) {
|
|
|
return $source;
|
|
|
}
|
|
|
if ($name) $this->setName($name);
|
|
|
+ $this->setQuality($quality);
|
|
|
$this->loadMethod('webp');
|
|
|
return $this->getDest('webp');
|
|
|
}
|
|
@@ -1051,8 +1052,11 @@ class Img
|
|
|
{
|
|
|
$this->_check('source');
|
|
|
$this->_dest['webp'] = $this->getName('.webp');
|
|
|
-
|
|
|
- $this->_image->setFormat('webp');
|
|
|
+
|
|
|
+ //apk add libwebp-tools
|
|
|
+ //Dever::run('cwebp -q 75 '.$this->_source.' -o ' . $this->_dest['webp']);
|
|
|
+
|
|
|
+ $this->_image->setImageFormat('webp');
|
|
|
$this->_image->writeImage($this->_dest['webp']);
|
|
|
}
|
|
|
|