From f68f704ec7aea17bff76405c2410bf1a25760670 Mon Sep 17 00:00:00 2001 From: Martin Portevin Date: Wed, 22 Mar 2017 19:36:53 +0100 Subject: [PATCH] Fix ImagickBackend and i18n Textcollector Task (#39) Prevents PHP Fatal error: Class 'ImagickBackend' not found when Imagick is not installed. --- code/FPImagickBackend.php | 32 +++++++++++++++++--------------- 1 file changed, 17 insertions(+), 15 deletions(-) diff --git a/code/FPImagickBackend.php b/code/FPImagickBackend.php index 863346c..856a1be 100644 --- a/code/FPImagickBackend.php +++ b/code/FPImagickBackend.php @@ -1,18 +1,20 @@ cropImage($width, $height, $left, $top); - - return $new; +if(class_exists('Imagick')) { + class FPImagickBackend extends ImagickBackend { + /** + * Crop's part of image. + * @param top y position of left upper corner of crop rectangle + * @param left x position of left upper corner of crop rectangle + * @param width rectangle width + * @param height rectangle height + * @return ImagickBackend + */ + public function crop($top, $left, $width, $height) { + $new = clone $this; + $new->cropImage($width, $height, $left, $top); + + return $new; + } } } -?> \ No newline at end of file +?>