diff --git a/libraries/joomla/image/image.php b/libraries/joomla/image/image.php index 88f1730d480c3..646fc9256d3df 100644 --- a/libraries/joomla/image/image.php +++ b/libraries/joomla/image/image.php @@ -88,6 +88,13 @@ class JImage */ protected static $formats = array(); + /** + * @var boolean True for best quality. False for speed + * + * @since 3.6.0 + */ + protected $generateBestQuality = true; + /** * Class constructor. * @@ -420,7 +427,10 @@ public function crop($width, $height, $left = null, $top = null, $createNew = tr // Set the transparent color values for the new image. imagecolortransparent($handle, $color); imagefill($handle, 0, 0, $color); + } + if (!$this->generateBestQuality) + { imagecopyresized($handle, $this->handle, 0, 0, $left, $top, $width, $height, $width, $height); } else @@ -550,7 +560,7 @@ public function isLoaded() /** * Method to determine whether or not the image has transparency. * - * @return bool + * @return boolean * * @since 11.3 * @throws LogicException @@ -749,7 +759,10 @@ public function resize($width, $height, $createNew = true, $scaleMethod = self:: // Set the transparent color values for the new image. imagecolortransparent($handle, $color); imagefill($handle, 0, 0, $color); + } + if (!$this->generateBestQuality) + { imagecopyresized( $handle, $this->handle, @@ -1179,4 +1192,18 @@ public function __destruct() { $this->destroy(); } + + /** + * Method for set option of generate thumbnail method + * + * @param boolean $quality True for best quality. False for best speed. + * + * @return void + * + * @since 3.6.0 + */ + public function setThumbnailGenerate($quality = true) + { + $this->generateBestQuality = (boolean) $quality; + } }