- if (!empty($this->attachment->mimetype)) {
- $mediatype = common_get_mime_media($this->attachment->mimetype);
+ if (!empty($enclosure->mimetype)) {
+ // First, prepare a thumbnail if it exists.
+ $thumb = null;
+ try {
+ // Tell getThumbnail that we can show an animated image if it has one (4th arg, "force_still")
+ $thumb = $this->attachment->getThumbnail(null, null, false, false);
+ } catch (UseFileAsThumbnailException $e) {
+ $thumb = null;
+ } catch (UnsupportedMediaException $e) {
+ // FIXME: Show a good representation of unsupported/unshowable images
+ $thumb = null;
+ }
+
+ // Then get the kind of mediatype we're dealing with
+ $mediatype = common_get_mime_media($enclosure->mimetype);