From 0b121a6ffec563f6a3d3195997f0b3809406c317 Mon Sep 17 00:00:00 2001 From: Michael Vogel Date: Sun, 17 Apr 2016 23:38:29 +0200 Subject: [PATCH] Improved handling of photos --- include/bbcode.php | 8 ++++++-- include/plaintext.php | 2 +- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/include/bbcode.php b/include/bbcode.php index 820a307cb6..61b929ec79 100644 --- a/include/bbcode.php +++ b/include/bbcode.php @@ -73,9 +73,13 @@ function bb_attachment($Text, $simplehtml = false, $tryoembed = true) { elseif (($data["preview"] != "") AND !strstr(strtolower($oembed), "
', $data["url"], proxy_url($data["preview"]), $data["title"]); - $text .= $oembed; + if (($data["type"] == "photo") AND ($data["url"] != "") AND ($data["image"] != "")) + $text .= sprintf('', $data["url"], proxy_url($data["image"]), $data["title"]); + else + $text .= $oembed; - $text .= sprintf('
%s
', trim($data["description"])); + if (trim($data["description"]) != "") + $text .= sprintf('
%s
', trim($data["description"])); } } return $data["text"].$text.$data["after"]; diff --git a/include/plaintext.php b/include/plaintext.php index c6e02a5b24..a6738ca93b 100644 --- a/include/plaintext.php +++ b/include/plaintext.php @@ -85,7 +85,7 @@ function get_attachment_data($body) { if ($type == "") return(array()); - if (!in_array($type, array("link", "audio", "video"))) + if (!in_array($type, array("link", "audio", "photo", "video"))) return(array()); if ($type != "")