diff --git a/yii/image/drivers/Kohana/Image/GD.php b/yii/image/drivers/Kohana/Image/GD.php index 9929543..af6cd70 100644 --- a/yii/image/drivers/Kohana/Image/GD.php +++ b/yii/image/drivers/Kohana/Image/GD.php @@ -104,6 +104,9 @@ public function __construct($file) case IMAGETYPE_PNG: $create = 'imagecreatefrompng'; break; + case IMAGETYPE_WEBP: + $create = 'imagecreatefromwebp'; + break; } if ( ! isset($create) OR ! function_exists($create)) @@ -657,6 +660,11 @@ protected function _save_function($extension, & $quality) // Use a compression level of 9 (does not affect quality!) $quality = 9; break; + case 'webp': + // Save a WEBP file + $save = 'imagewebp'; + $type = IMAGETYPE_WEBP; + break; default: throw new ErrorException(sprintf('Installed GD does not support %s images',$extension)); break;