From: Michael Date: Sat, 10 Dec 2022 19:08:56 +0000 (+0000) Subject: ID added for list of images in a post X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=870fd1a52bffb79861a3c8298f4c0e91c92428f2;p=friendica.git ID added for list of images in a post --- diff --git a/src/Content/Text/BBCode.php b/src/Content/Text/BBCode.php index ae21d05e13..62ad04a434 100644 --- a/src/Content/Text/BBCode.php +++ b/src/Content/Text/BBCode.php @@ -273,8 +273,8 @@ class BBCode // Get all linked images with alternative image description if (preg_match_all("/\[img=(http[^\[\]]*)\]([^\[\]]*)\[\/img\]/Usi", $body, $pictures, PREG_SET_ORDER)) { foreach ($pictures as $picture) { - if (Photo::isLocal($picture[1])) { - $post['images'][] = ['url' => str_replace('-1.', '-0.', $picture[1]), 'description' => $picture[2]]; + if ($id = Photo::getIdForName($picture[1])) { + $post['images'][] = ['url' => str_replace('-1.', '-0.', $picture[1]), 'description' => $picture[2], 'id' => $id]; } else { $post['remote_images'][] = ['url' => $picture[1], 'description' => $picture[2]]; } @@ -286,8 +286,8 @@ class BBCode if (preg_match_all("/\[img\]([^\[\]]*)\[\/img\]/Usi", $body, $pictures, PREG_SET_ORDER)) { foreach ($pictures as $picture) { - if (Photo::isLocal($picture[1])) { - $post['images'][] = ['url' => str_replace('-1.', '-0.', $picture[1]), 'description' => '']; + if ($id = Photo::getIdForName($picture[1])) { + $post['images'][] = ['url' => str_replace('-1.', '-0.', $picture[1]), 'description' => '', 'id' => $id]; } else { $post['remote_images'][] = ['url' => $picture[1], 'description' => '']; }