From e49e1131404870ae9f8590a8a2012d9218946cc7 Mon Sep 17 00:00:00 2001 From: Mikael Nordfeldth Date: Tue, 12 Jan 2016 15:38:59 +0100 Subject: [PATCH] Ugly hack to show thumbnails of otherwise unrepresentable attachments such as text/html, where the thumbnail has been retrieved via oEmbed/OpenGraph --- lib/attachmentlistitem.php | 6 ++++++ 1 file changed, 6 insertions(+) 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': -- 2.39.5