Fix: Posts with pictures will now look good again on connector networks

This commit is contained in:
Michael 2018-09-06 04:24:34 +00:00
parent 31cbc80981
commit 04fb885857
3 changed files with 8 additions and 9 deletions

View file

@ -1633,7 +1633,7 @@ function photos_content(App $a)
'$paginate' => $paginate, '$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:title" content="' . $photo["album"] . '" />' . "\n";
$a->page['htmlhead'] .= '<meta name="twitter:image" content="' . $photo["href"] . '" />' . "\n"; $a->page['htmlhead'] .= '<meta name="twitter:image" content="' . $photo["href"] . '" />' . "\n";
$a->page['htmlhead'] .= '<meta name="twitter:image:width" content="' . $photo["width"] . '" />' . "\n"; $a->page['htmlhead'] .= '<meta name="twitter:image:width" content="' . $photo["width"] . '" />' . "\n";

View 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"]); $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']); $return .= sprintf('<h4><a href="%s">%s</a></h4>', $data['url'], $data['title']);
} }

View file

@ -271,9 +271,9 @@ class ParseUrl
$siteinfo['image'] = $meta_tag['content']; $siteinfo['image'] = $meta_tag['content'];
break; break;
case 'twitter:card': case 'twitter:card':
// Obsolete card type // Convert Twitter types in our own
if ($meta_tag['content'] == 'photo') { if ($meta_tag['content'] == 'summary_large_image') {
$siteinfo['type'] = 'summary_large_image'; $siteinfo['type'] = 'photo';
} else { } else {
$siteinfo['type'] = $meta_tag['content']; $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)) { if (isset($keywords)) {
$siteinfo['keywords'] = []; $siteinfo['keywords'] = [];
foreach ($keywords as $keyword) { foreach ($keywords as $keyword) {