]> 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 4645a8678a59fd1e330614315a364dfb01005a07..8c8ebfb29d3f315e76528c7d17be48624eb0466d 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 /**
- * @copyright Copyright (C) 2020, Friendica
+ * @copyright Copyright (C) 2010-2021, the Friendica project
  *
  * @license GNU AGPL version 3 or any later version
  *
@@ -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();