]> git.mxchange.org Git - friendica.git/blobdiff - src/Model/Photo.php
Implement relationship termination for Mastodon block
[friendica.git] / src / Model / Photo.php
index 8df9b92f2d8e0a0cb891d5a50bb091f84e8f363e..c09434d7f237a477c80fbb0dc25e63e4643aac8a 100644 (file)
@@ -196,13 +196,8 @@ class Photo
 
                try {
                        $backendClass = DI::storageManager()->getByName($photo['backend-class'] ?? '');
-                       $image        = $backendClass->get($photo['backend-ref'] ?? '');
-
-                       if ($image instanceof Image) {
-                               return $image;
-                       } else {
-                               DI::logger()->info('Stored data is not an image', ['photo' => $photo]);
-                       }
+                       /// @todo refactoring this returning, because the storage returns a "string" which is casted in different ways - a check "instanceof Image" will fail!
+                       return $backendClass->get($photo['backend-ref'] ?? '');
                } catch (InvalidClassStorageException $storageException) {
                        try {
                                // legacy data storage in "data" column
@@ -418,7 +413,7 @@ class Photo
                while ($photo = DBA::fetch($photos)) {
                        try {
                                $backend_class = DI::storageManager()->getWritableStorageByName($photo['backend-class'] ?? '');
-                               $backend_class->delete($item['backend-ref'] ?? '');
+                               $backend_class->delete($photo['backend-ref'] ?? '');
                                // Delete the photos after they had been deleted successfully
                                DBA::delete("photo", ['id' => $photo['id']]);
                        } catch (InvalidClassStorageException $storageException) {
@@ -495,11 +490,12 @@ class Photo
 
                $filename = basename($image_url);
                if (!empty($image_url)) {
-                       $ret = DI::httpRequest()->get($image_url);
+                       $ret = DI::httpClient()->get($image_url);
                        $img_str = $ret->getBody();
                        $type = $ret->getContentType();
                } else {
                        $img_str = '';
+                       $type = '';
                }
 
                if ($quit_on_error && ($img_str == "")) {