]> git.mxchange.org Git - friendica.git/blobdiff - src/Model/Post/Media.php
Return as array
[friendica.git] / src / Model / Post / Media.php
index 90f42a45934fb9fecb458251159a4aae02f6ea81..801f192e9d93584fc10c49250d99317e2d6c833c 100644 (file)
@@ -224,7 +224,7 @@ class Media
 
        /**
         * Fetch media data from local resources
-        * @param array $media 
+        * @param array $media
         * @return array media with added data
         */
        private static function fetchLocalData(array $media)
@@ -388,7 +388,7 @@ class Media
 
                foreach ($attachments as $attachment) {
                        // Only store attachments that are part of the unshared body
-                       if (Item::containsLink($unshared_body, $attachment['url'], $attachment['type'])) {
+                       if (Item::containsLink($unshared_body, $attachment['preview'] ?? $attachment['url'], $attachment['type'])) {
                                self::insert($attachment);
                        }
                }
@@ -637,7 +637,7 @@ class Media
                $body = preg_replace("/\s*\[attachment .*?\].*?\[\/attachment\]\s*/ism", '', $body);
 
                foreach (self::getByURIId($uriid, [self::IMAGE, self::AUDIO, self::VIDEO]) as $media) {
-                       if (Item::containsLink($body, $media['url'], $media['type'])) {
+                       if (Item::containsLink($body, $media['preview'] ?? $media['url'], $media['type'])) {
                                continue;
                        }