concrete5/concrete5 — pull request #1364 by JeffPaetkau (2013-09-11 18:41:32+00:00)
Title: Add support for Imagick if present

Imagick is faster and more memory efficient than GD but less commonly installed. This uses Imagick if present otherwise falls back on GD. This may help reduce out of memory errors on larger images.

The diff is deceiving the only code changed/added is:

if(!class_exists("Imagick")) {
...
} else {
$image = new Imagick();
if ($crop) {
$image->setSize($finalWidth, $finalHeight);
$image->readImage($originalPath);
$image->cropThumbnailImage($width, $height);
} else {
$image->setSize($width, $height);
$image->readImage($originalPath);
$image->thumbnailImage($width, $height, true);
}
if($image->getCompression() == imagick::COMPRESSION_JPEG) {
$image->setCompressionQuality($this->jpegCompression);
}
$image->writeImage($newPath);
}