]> git.mxchange.org Git - friendica.git/commitdiff
Fix: Posts with pictures will now look good again on connector networks
authorMichael <heluecht@pirati.ca>
Thu, 6 Sep 2018 04:24:34 +0000 (04:24 +0000)
committerMichael <heluecht@pirati.ca>
Thu, 6 Sep 2018 04:24:34 +0000 (04:24 +0000)
mod/photos.php
src/Content/Text/BBCode.php
src/Util/ParseUrl.php

index 5fb6ba368354aab0735da2000e17d1d55354b6de..16af455997ddf6d2ec1a76e6acde8ee64d4e365c 100644 (file)
@@ -1633,7 +1633,7 @@ function photos_content(App $a)
                        '$paginate' => $paginate,
                ]);
 
-               $a->page['htmlhead'] .= "\n" . '<meta name="twitter:card" content="photo" />' . "\n";
+               $a->page['htmlhead'] .= "\n" . '<meta name="twitter:card" content="summary_large_image" />' . "\n";
                $a->page['htmlhead'] .= '<meta name="twitter:title" content="' . $photo["album"] . '" />' . "\n";
                $a->page['htmlhead'] .= '<meta name="twitter:image" content="' . $photo["href"] . '" />' . "\n";
                $a->page['htmlhead'] .= '<meta name="twitter:image:width" content="' . $photo["width"] . '" />' . "\n";
index 55fc24273da7954b3ae45701706c3e6fb384be2b..3054170fc05065fd0c17c1e7cc36843c6a0d3129 100644 (file)
@@ -578,7 +578,10 @@ class BBCode extends BaseObject
                                        $return .= sprintf('<a href="%s" target="_blank"><img src="%s" alt="" title="%s" class="attachment-preview" /></a><br />', $data["url"], self::proxyUrl($data["preview"], $simplehtml), $data["title"]);
                                }
 
-                               if (!empty($data['title']) && !empty($data['url'])) {
+                               // Show a picture only when the BBCode is meant for posts to connector networks
+                               if (($simplehtml != 0) && ($data["type"] == "photo") && !empty($data["url"]) && !empty($data["image"])) {
+                                       $return .= sprintf('<a href="%s" target="_blank"><img src="%s" alt="" title="%s" class="attachment-image" /></a>', $data["url"], self::proxyUrl($data["image"], $simplehtml), $data["title"]);
+                               } elseif (!empty($data['title']) && !empty($data['url'])) {
                                        $return .= sprintf('<h4><a href="%s">%s</a></h4>', $data['url'], $data['title']);
                                }
 
index 2c134542a0392e279dd6f64f4008ec7cf8e52c74..520100b6d7c65f266f49ae2eb6ffb8473542c917 100644 (file)
@@ -271,9 +271,9 @@ class ParseUrl
                                        $siteinfo['image'] = $meta_tag['content'];
                                        break;
                                case 'twitter:card':
-                                       // Obsolete card type
-                                       if ($meta_tag['content'] == 'photo') {
-                                               $siteinfo['type'] = 'summary_large_image';
+                                       // Convert Twitter types in our own
+                                       if ($meta_tag['content'] == 'summary_large_image') {
+                                               $siteinfo['type'] = 'photo';
                                        } else {
                                                $siteinfo['type'] = $meta_tag['content'];
                                        }
@@ -299,10 +299,6 @@ class ParseUrl
                        }
                }
 
-               if ($siteinfo['type'] == 'summary' || $siteinfo['type'] == 'summary_large_image') {
-                       $siteinfo['type'] = 'link';
-               }
-
                if (isset($keywords)) {
                        $siteinfo['keywords'] = [];
                        foreach ($keywords as $keyword) {