Ugly hack to show thumbnails of otherwise unrepresentable attachments

such as text/html, where the thumbnail has been retrieved via oEmbed/OpenGraph
This commit is contained in:
Mikael Nordfeldth 2016-01-12 15:38:59 +01:00
parent 3658774429
commit e49e113140
1 changed files with 6 additions and 0 deletions

View File

@ -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':