<?php
/**
- * @copyright Copyright (C) 2010-2022, the Friendica project
+ * @copyright Copyright (C) 2010-2023, the Friendica project
*
* @license GNU AGPL version 3 or any later version
*
public function isValid(): bool
{
if ($this->isImagick()) {
- return ($this->image !== false);
+ return !empty($this->image);
}
return $this->valid;
}
$orientation = $this->image->getImageOrientation();
switch ($orientation) {
case Imagick::ORIENTATION_BOTTOMRIGHT:
- $this->rotate( 180);
+ $this->rotate(180);
break;
case Imagick::ORIENTATION_RIGHTTOP:
$this->rotate(-90);
do {
$this->image->cropImage($w, $h, $x, $y);
/*
- * We need to remove the canva,
+ * We need to remove the canvas,
* or the image is not resized to the crop:
* http://php.net/manual/en/imagick.cropimage.php#97232
*/
if ($image->isImagick()) {
try {
$colors = $image->image->getImagePixelColor($x, $y)->getColor();
- } catch (\Throwable $th) {
+ } catch (\Exception $exception) {
return '';
}
$row[] = [$colors['r'], $colors['g'], $colors['b']];