]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
Ugly hack to show thumbnails of otherwise unrepresentable attachments
authorMikael Nordfeldth <mmn@hethane.se>
Tue, 12 Jan 2016 14:38:59 +0000 (15:38 +0100)
committerMikael Nordfeldth <mmn@hethane.se>
Tue, 12 Jan 2016 14:38:59 +0000 (15:38 +0100)
such as text/html, where the thumbnail has been retrieved via oEmbed/OpenGraph

lib/attachmentlistitem.php

index 2d484fb6a8e1de797c572305edec477a850d2d6d..8adc07e6db7c59bd1c7ab40d8a245d3e6f0a0364 100644 (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':