From: Mikael Nordfeldth Date: Tue, 12 Jan 2016 14:38:59 +0000 (+0100) Subject: Ugly hack to show thumbnails of otherwise unrepresentable attachments X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=e49e1131404870ae9f8590a8a2012d9218946cc7;p=quix0rs-gnu-social.git Ugly hack to show thumbnails of otherwise unrepresentable attachments such as text/html, where the thumbnail has been retrieved via oEmbed/OpenGraph --- diff --git a/lib/attachmentlistitem.php b/lib/attachmentlistitem.php index 2d484fb6a8..8adc07e6db 100644 --- a/lib/attachmentlistitem.php +++ b/lib/attachmentlistitem.php @@ -129,6 +129,12 @@ class AttachmentListItem extends Widget if ($this->attachment->mimetype === 'application/ogg') { $mediatype = 'video'; // because this element can handle Ogg/Vorbis etc. on its own } + + // Ugly hack to show text/html links which have a thumbnail (such as from oEmbed/OpenGraph image URLs) + if (!in_array($mediatype, ['image','audio','video']) && $thumb instanceof File_thumbnail) { + $mediatype = 'image'; + } + switch ($mediatype) { // Anything we understand as an image, if we need special treatment, do it in StartShowAttachmentRepresentation case 'image':