mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
NEW GDBackend can save interlaced image
Disabled by default use config GDBackend.image_interlace: 1 to enable
This commit is contained in:
parent
f532b8483b
commit
19928ff5e8
@ -7,6 +7,7 @@
|
||||
class GDBackend extends Object implements Image_Backend {
|
||||
protected $gd, $width, $height;
|
||||
protected $quality;
|
||||
protected $interlace;
|
||||
|
||||
/**
|
||||
* @config
|
||||
@ -14,6 +15,12 @@ class GDBackend extends Object implements Image_Backend {
|
||||
*/
|
||||
private static $default_quality = 75;
|
||||
|
||||
/**
|
||||
* @config
|
||||
* @var integer
|
||||
*/
|
||||
private static $image_interlace = 0;
|
||||
|
||||
/**
|
||||
* Set the default image quality.
|
||||
*
|
||||
@ -56,6 +63,7 @@ class GDBackend extends Object implements Image_Backend {
|
||||
parent::__construct();
|
||||
|
||||
$this->quality = $this->config()->default_quality;
|
||||
$this->interlace = $this->config()->image_interlace;
|
||||
}
|
||||
|
||||
public function setImageResource($resource) {
|
||||
@ -456,6 +464,9 @@ class GDBackend extends Object implements Image_Backend {
|
||||
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!
|
||||
|
||||
switch($type) {
|
||||
|
Loading…
Reference in New Issue
Block a user