]> git.mxchange.org Git - friendica.git/commitdiff
Improved handling of photos
authorMichael Vogel <icarus@dabo.de>
Sun, 17 Apr 2016 21:38:29 +0000 (23:38 +0200)
committerMichael Vogel <icarus@dabo.de>
Sun, 17 Apr 2016 21:38:29 +0000 (23:38 +0200)
include/bbcode.php
include/plaintext.php

index 820a307cb695c06ff02f6c42503c8c677c129fea..61b929ec795904a75746275ad359f8e53e1e0c4e 100644 (file)
@@ -73,9 +73,13 @@ function bb_attachment($Text, $simplehtml = false, $tryoembed = true) {
                        elseif (($data["preview"] != "") AND !strstr(strtolower($oembed), "<img "))
                                $text .= sprintf('<a href="%s" target="_blank"><img src="%s" alt="" title="%s" class="attachment-preview" /></a><br />', $data["url"], proxy_url($data["preview"]), $data["title"]);
 
-                       $text .= $oembed;
+                       if (($data["type"] == "photo") AND ($data["url"] != "") AND ($data["image"] != ""))
+                               $text .= sprintf('<a href="%s" target="_blank"><img src="%s" alt="" title="%s" class="attachment-image" /></a>', $data["url"], proxy_url($data["image"]), $data["title"]);
+                       else
+                               $text .= $oembed;
 
-                       $text .= sprintf('<blockquote>%s</blockquote></span>', trim($data["description"]));
+                       if (trim($data["description"]) != "")
+                               $text .= sprintf('<blockquote>%s</blockquote></span>', trim($data["description"]));
                }
        }
        return $data["text"].$text.$data["after"];
index c6e02a5b24f3e21352752ba033d7fa5e62d93dc2..a6738ca93b5bfb2d33aac1bd3342ad63a9dbc2f9 100644 (file)
@@ -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 != "")