Skip to content

Commit

Permalink
Fix ImagickBackend and i18n Textcollector Task (#39)
Browse files Browse the repository at this point in the history
Prevents PHP Fatal error: Class 'ImagickBackend' not found when Imagick is not installed.
  • Loading branch information
DrMartinGonzo authored and jonom committed Mar 22, 2017
1 parent 9f3b2dd commit f68f704
Showing 1 changed file with 17 additions and 15 deletions.
32 changes: 17 additions & 15 deletions code/FPImagickBackend.php
Original file line number Diff line number Diff line change
@@ -1,18 +1,20 @@
<?php
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;
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;
}
}
}
?>
?>

0 comments on commit f68f704

Please sign in to comment.