]> git.mxchange.org Git - friendica.git/blobdiff - src/Object/Image.php
Merge pull request #10551 from annando/profiler
[friendica.git] / src / Object / Image.php
index 2ae43520ed6b9032e5070a2aeddfe196feaa3049..8c8ebfb29d3f315e76528c7d17be48624eb0466d 100644 (file)
@@ -230,9 +230,13 @@ class Image
                }
 
                if ($this->isImagick()) {
-                       /* Clean it */
-                       $this->image = $this->image->deconstructImages();
-                       return $this->image;
+                       try {
+                               /* Clean it */
+                               $this->image = $this->image->deconstructImages();
+                               return $this->image;
+                       } catch (Exception $e) {
+                               return false;
+                       }
                }
                return $this->image;
        }
@@ -646,9 +650,9 @@ class Image
 
                $string = $this->asString();
 
-               $stamp1 = microtime(true);
+               DI::profiler()->stopRecording('file');
                file_put_contents($path, $string);
-               DI::profiler()->saveTimestamp($stamp1, "file");
+               DI::profiler()->stopRecording();
        }
 
        /**
@@ -676,10 +680,14 @@ class Image
                }
 
                if ($this->isImagick()) {
-                       /* Clean it */
-                       $this->image = $this->image->deconstructImages();
-                       $string = $this->image->getImagesBlob();
-                       return $string;
+                       try {
+                               /* Clean it */
+                               $this->image = $this->image->deconstructImages();
+                               $string = $this->image->getImagesBlob();
+                               return $string;
+                       } catch (Exception $e) {
+                               return false;
+                       }
                }
 
                ob_start();