]> git.mxchange.org Git - friendica.git/blobdiff - src/Object/Image.php
Merge pull request #12390 from annando/fixes
[friendica.git] / src / Object / Image.php
index c798f250ed8748de607c80dad71f708840eff48b..06498f963fcb859b78d4d96c5381824ddd6b0794 100644 (file)
@@ -734,6 +734,9 @@ class Image
        public function getBlurHash(): string
        {
                $image = New Image($this->asString());
+               if (empty($image)) {
+                       return '';
+               }
 
                $width = $image->getWidth();
                $height = $image->getHeight();
@@ -749,7 +752,11 @@ class Image
                        $row = [];
                        for ($x = 0; $x < $width; ++$x) {
                                if ($image->isImagick()) {
-                                       $colors = $image->image->getImagePixelColor($x, $y)->getColor();
+                                       try {
+                                               $colors = $image->image->getImagePixelColor($x, $y)->getColor();
+                                       } catch (\Throwable $th) {
+                                               return '';
+                                       }
                                        $row[] = [$colors['r'], $colors['g'], $colors['b']];
                                } else {
                                        $index = imagecolorat($image->image, $x, $y);