diff --git a/include/api.php b/include/api.php
index d8cd6d2e2..543c01827 100644
--- a/include/api.php
+++ b/include/api.php
@@ -2696,7 +2696,7 @@ function api_get_entitities(&$text, $bbcode)
preg_match_all("/\[img\=(.*?)\](.*?)\[\/img\]/ism", $bbcode, $images, PREG_SET_ORDER);
$ordered_images = [];
foreach ($images as $image) {
- $start = iconv_strpos($text, Photo::getGUID($image[1]), 0, "UTF-8");
+ $start = iconv_strpos($text, $image[1], 0, "UTF-8");
if (!($start === false)) {
$ordered_images[$start] = ['url' => $image[1], 'alt' => $image[2]];
}
@@ -2704,7 +2704,7 @@ function api_get_entitities(&$text, $bbcode)
preg_match_all("/\[img](.*?)\[\/img\]/ism", $bbcode, $images);
foreach ($images[1] as $image) {
- $start = iconv_strpos($text, Photo::getGUID($image), 0, "UTF-8");
+ $start = iconv_strpos($text, $image, 0, "UTF-8");
if (!($start === false)) {
$ordered_images[$start] = ['url' => $image, 'alt' => ''];
}
@@ -2723,7 +2723,7 @@ function api_get_entitities(&$text, $bbcode)
$display_url = substr($display_url, 0, 25)."…";
}
- $start = iconv_strpos($text, Photo::getGUID($url), $offset, "UTF-8");
+ $start = iconv_strpos($text, $url, $offset, "UTF-8");
if (!($start === false)) {
$image = Image::getInfoFromURL($url);
if ($image) {
diff --git a/mod/photos.php b/mod/photos.php
index fa4d5b281..fb43619b6 100644
--- a/mod/photos.php
+++ b/mod/photos.php
@@ -1567,7 +1567,7 @@ function photos_content(App $a)
$a->page['htmlhead'] .= "\n" . '' . "\n";
$a->page['htmlhead'] .= '' . "\n";
- $a->page['htmlhead'] .= '' . "\n";
+ $a->page['htmlhead'] .= '' . "\n";
$a->page['htmlhead'] .= '' . "\n";
$a->page['htmlhead'] .= '' . "\n";
diff --git a/src/Content/Text/BBCode.php b/src/Content/Text/BBCode.php
index e2a4fa603..b2d4ebb5d 100644
--- a/src/Content/Text/BBCode.php
+++ b/src/Content/Text/BBCode.php
@@ -1102,7 +1102,11 @@ class BBCode extends BaseObject
if (substr($curl_info["content_type"], 0, 6) == "image/") {
$text = "[img]" . $match[1] . "[/img]";
} else {
- $text = "[img]" . $match[2] . "[/img]";
+ if (!empty($match[3])) {
+ $text = "[img=" . $match[2] . "]" . $match[3] . "[/img]";
+ } else {
+ $text = "[img]" . $match[2] . "[/img]";
+ }
// if its not a picture then look if its a page that contains a picture link
$body = Network::fetchUrl($match[1]);
@@ -1120,7 +1124,11 @@ class BBCode extends BaseObject
}
if (strtolower($attr["name"]) == "twitter:image") {
- $text = "[img]" . $attr["content"] . "[/img]";
+ if (!empty($match[3])) {
+ $text = "[img=" . $attr["content"] . "]" . $match[3] . "[/img]";
+ } else {
+ $text = "[img]" . $attr["content"] . "[/img]";
+ }
}
}
}
@@ -1132,7 +1140,8 @@ class BBCode extends BaseObject
public static function cleanPictureLinks($text)
{
- $return = preg_replace_callback("&\[url=([^\[\]]*)\]\[img\](.*)\[\/img\]\[\/url\]&Usi", 'self::cleanPictureLinksCallback', $text);
+ $return = preg_replace_callback("&\[url=([^\[\]]*)\]\[img=(.*)\](.*)\[\/img\]\[\/url\]&Usi", 'self::cleanPictureLinksCallback', $text);
+ $return = preg_replace_callback("&\[url=([^\[\]]*)\]\[img\](.*)\[\/img\]\[\/url\]&Usi", 'self::cleanPictureLinksCallback', $return);
return $return;
}