Add thumbnail quality parameter (default to 95)
This commit is contained in:
committed by
Frédéric Guillot
parent
67da76e7f1
commit
5d908b4c70
@@ -10,6 +10,7 @@ namespace Kanboard\Core;
|
|||||||
*/
|
*/
|
||||||
class Thumbnail
|
class Thumbnail
|
||||||
{
|
{
|
||||||
|
protected $quality = 95;
|
||||||
protected $metadata = array();
|
protected $metadata = array();
|
||||||
protected $srcImage;
|
protected $srcImage;
|
||||||
protected $dstImage;
|
protected $dstImage;
|
||||||
@@ -137,7 +138,7 @@ class Thumbnail
|
|||||||
*/
|
*/
|
||||||
public function toFile($filename)
|
public function toFile($filename)
|
||||||
{
|
{
|
||||||
imagejpeg($this->dstImage, $filename);
|
imagejpeg($this->dstImage, $filename, $this->quality);
|
||||||
imagedestroy($this->dstImage);
|
imagedestroy($this->dstImage);
|
||||||
imagedestroy($this->srcImage);
|
imagedestroy($this->srcImage);
|
||||||
return $this;
|
return $this;
|
||||||
@@ -152,7 +153,7 @@ class Thumbnail
|
|||||||
public function toString()
|
public function toString()
|
||||||
{
|
{
|
||||||
ob_start();
|
ob_start();
|
||||||
imagejpeg($this->dstImage, null);
|
imagejpeg($this->dstImage, null, $this->quality);
|
||||||
imagedestroy($this->dstImage);
|
imagedestroy($this->dstImage);
|
||||||
imagedestroy($this->srcImage);
|
imagedestroy($this->srcImage);
|
||||||
return ob_get_clean();
|
return ob_get_clean();
|
||||||
@@ -165,7 +166,7 @@ class Thumbnail
|
|||||||
*/
|
*/
|
||||||
public function toOutput()
|
public function toOutput()
|
||||||
{
|
{
|
||||||
imagejpeg($this->dstImage, null);
|
imagejpeg($this->dstImage, null, $this->quality);
|
||||||
imagedestroy($this->dstImage);
|
imagedestroy($this->dstImage);
|
||||||
imagedestroy($this->srcImage);
|
imagedestroy($this->srcImage);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user