]> git.mxchange.org Git - friendica.git/blobdiff - src/Model/Photo.php
Merge pull request #10722 from MrPetovan/task/refactor-notifications
[friendica.git] / src / Model / Photo.php
index 039fee779a9943bbe53edb53ac5931026e69296d..7d97d6398c69b5bfa6b336292493d88c3f9796f4 100644 (file)
@@ -413,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) {
@@ -799,22 +799,6 @@ class Photo
                Photo::update($fields, $condition);
        }
 
-       /**
-        * Strips known picture extensions from picture links
-        *
-        * @param string $name Picture link
-        * @return string stripped picture link
-        * @throws \Exception
-        */
-       public static function stripExtension($name)
-       {
-               $name = str_replace([".jpg", ".png", ".gif"], ["", "", ""], $name);
-               foreach (Images::supportedTypes() as $m => $e) {
-                       $name = str_replace("." . $e, "", $name);
-               }
-               return $name;
-       }
-
        /**
         * Fetch the guid and scale from picture links
         *
@@ -831,7 +815,7 @@ class Photo
                        return [];
                }
 
-               $guid = self::stripExtension($guid);
+               $guid = pathinfo($guid, PATHINFO_FILENAME);
                if (substr($guid, -2, 1) != "-") {
                        return [];
                }