diff --git a/yii/image/drivers/Kohana/Image.php b/yii/image/drivers/Kohana/Image.php index 7271c3c..5069365 100644 --- a/yii/image/drivers/Kohana/Image.php +++ b/yii/image/drivers/Kohana/Image.php @@ -701,6 +701,23 @@ public function save($file = NULL, $quality = 100) return $this->_do_save($file, $quality); } + /** + * Enable or disable interlace for progressive images + * + * GD + * Just use true or false for enable or disable interlace for jpeg files. + * + * Imagick + * Use INTERLACE constants from http://php.net/manual/en/imagick.constants.php + * + * @param $scheme bool|int + * @return mixed + */ + public function interlace($scheme) + { + return $this->_do_interlace($scheme); + } + /** * Render the image and return the binary string. * @@ -832,4 +849,12 @@ abstract protected function _do_save($file, $quality); */ abstract protected function _do_render($type, $quality); + /** + * Execute an interlace. + * + * @param $scheme + * @return mixed + */ + abstract protected function _do_interlace($scheme); + } // End Image diff --git a/yii/image/drivers/Kohana/Image/GD.php b/yii/image/drivers/Kohana/Image/GD.php index 9e93945..0b6ff6e 100644 --- a/yii/image/drivers/Kohana/Image/GD.php +++ b/yii/image/drivers/Kohana/Image/GD.php @@ -685,4 +685,12 @@ protected function _create($width, $height) return $image; } + protected function _do_interlace($scheme) + { + // Loads image if not yet loaded + $this->_load_image(); + + return imageinterlace($this->_image, $scheme); + } + } // End Image_GD diff --git a/yii/image/drivers/Kohana/Image/Imagick.php b/yii/image/drivers/Kohana/Image/Imagick.php index 411c782..322d8d5 100644 --- a/yii/image/drivers/Kohana/Image/Imagick.php +++ b/yii/image/drivers/Kohana/Image/Imagick.php @@ -364,4 +364,9 @@ protected function _get_imagetype($extension) return array($format, $type); } + + protected function _do_interlace($scheme) + { + return $this->im->setInterlaceScheme($scheme); + } } // End Kohana_Image_Imagick