mirror of
https://github.com/friendica/friendica
synced 2025-04-25 11:50:11 +00:00
Unifiy the creation of photo links
This commit is contained in:
parent
4c40bc164d
commit
7d91cc73de
5 changed files with 34 additions and 14 deletions
|
@ -489,7 +489,7 @@ class Media
|
|||
if (preg_match_all("#\[url=([^\]]+?)\]\s*\[img=([^\[\]]*)\]([^\[\]]*)\[\/img\]\s*\[/url\]#ism", $body, $pictures, PREG_SET_ORDER)) {
|
||||
foreach ($pictures as $picture) {
|
||||
if (self::isLinkToImagePage($picture[1], $picture[2])) {
|
||||
$body = str_replace($picture[0], '[url=' . str_replace(['-1.', '-2.'], '-0.', $picture[2]) . '][img=' . $picture[2] . ']' . $picture[3] . '[/img][/url]', $body);
|
||||
$body = str_replace($picture[0], Images::getPictureUrl(str_replace(['-1.', '-2.'], '-0.', $picture[2]), $picture[2], $picture[3]), $body);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -497,7 +497,7 @@ class Media
|
|||
if (preg_match_all("#\[url=([^\]]+?)\]\s*\[img\]([^\[]+?)\[/img\]\s*\[/url\]#ism", $body, $pictures, PREG_SET_ORDER)) {
|
||||
foreach ($pictures as $picture) {
|
||||
if (self::isLinkToImagePage($picture[1], $picture[2])) {
|
||||
$body = str_replace($picture[0], '[url=' . str_replace(['-1.', '-2.'], '-0.', $picture[2]) . '][img]' . $picture[2] . '[/img][/url]', $body);
|
||||
$body = str_replace($picture[0], Images::getPictureUrl(str_replace(['-1.', '-2.'], '-0.', $picture[2]), $picture[2], ''), $body);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1005,11 +1005,7 @@ class Media
|
|||
|
||||
if ($media['type'] == self::IMAGE) {
|
||||
if (!empty($media['preview'])) {
|
||||
if (!empty($media['description'])) {
|
||||
$body .= "\n[url=" . $media['url'] . "][img=" . $media['preview'] . ']' . $media['description'] . '[/img][/url]';
|
||||
} else {
|
||||
$body .= "\n[url=" . $media['url'] . "][img]" . $media['preview'] . '[/img][/url]';
|
||||
}
|
||||
$body .= "\n" . Images::getPictureUrl($media['url'], $media['preview'], $media['description']);
|
||||
} else {
|
||||
if (!empty($media['description'])) {
|
||||
$body .= "\n[img=" . $media['url'] . ']' . $media['description'] . '[/img]';
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue