NEW GDBackend can save interlaced image

Disabled by default use config GDBackend.image_interlace: 1 to enable
This commit is contained in:
colymba 2013-10-19 14:46:23 +03:00
parent f532b8483b
commit 19928ff5e8

View File

@ -7,6 +7,7 @@
class GDBackend extends Object implements Image_Backend { class GDBackend extends Object implements Image_Backend {
protected $gd, $width, $height; protected $gd, $width, $height;
protected $quality; protected $quality;
protected $interlace;
/** /**
* @config * @config
@ -14,6 +15,12 @@ class GDBackend extends Object implements Image_Backend {
*/ */
private static $default_quality = 75; private static $default_quality = 75;
/**
* @config
* @var integer
*/
private static $image_interlace = 0;
/** /**
* Set the default image quality. * Set the default image quality.
* *
@ -56,6 +63,7 @@ class GDBackend extends Object implements Image_Backend {
parent::__construct(); parent::__construct();
$this->quality = $this->config()->default_quality; $this->quality = $this->config()->default_quality;
$this->interlace = $this->config()->image_interlace;
} }
public function setImageResource($resource) { public function setImageResource($resource) {
@ -455,6 +463,9 @@ class GDBackend extends Object implements Image_Backend {
case "jpeg": case "jpg": case "jpe": $type = IMAGETYPE_JPEG; break; case "jpeg": case "jpg": case "jpe": $type = IMAGETYPE_JPEG; break;
default: $type = IMAGETYPE_PNG; break; default: $type = IMAGETYPE_PNG; break;
} }
// if $this->interlace != 0, the output image will be interlaced
imageinterlace ($this->gd, $this->interlace);
// if the extension does not exist, the file will not be created! // if the extension does not exist, the file will not be created!