]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - lib/attachmentlistitem.php
Merge branch 'master' into social-master
[quix0rs-gnu-social.git] / lib / attachmentlistitem.php
index 6b8df0dd3962537cfbcd7bd20bffdf99ecff9fa5..3dbce148f8644d4985fa59af17b377ded7fac84b 100644 (file)
@@ -63,7 +63,7 @@ class AttachmentListItem extends Widget
     }
 
     function title() {
-        return $this->attachment->title ?: $this->attachment->filename;
+        return $this->attachment->getTitle();
     }
 
     function linkTitle() {
@@ -113,8 +113,11 @@ class AttachmentListItem extends Widget
                 case 'image/jpg':
                 case 'image/jpeg':
                     try {
-                        $thumb = $this->attachment->getThumbnail();
-                        $this->out->element('img', array('src' => $thumb->getUrl(), 'alt' => ''));
+                        // 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);
+                        $this->out->element('img', array('class'=>'u-photo', 'src' => $thumb->getUrl(), 'alt' => ''));
+                    } catch (UseFileAsThumbnailException $e) {
+                        $this->out->element('img', array('class'=>'u-photo', 'src' => $e->file->getUrl(), 'alt' => $e->file->title));
                     } catch (UnsupportedMediaException $e) {
                         // FIXME: Show a good representation of unsupported/unshowable images
                     }
@@ -149,7 +152,7 @@ class AttachmentListItem extends Widget
                         $poster = null;
                     }
                     $this->out->elementStart($mediatype,
-                                        array('class'=>'attachment_player',
+                                        array('class'=>"attachment_player u-{$mediatype}",
                                             'poster'=>$poster,
                                             'controls'=>'controls'));
                     $this->out->element('source',
@@ -159,7 +162,8 @@ class AttachmentListItem extends Widget
                     break;
 
                 case 'text/html':
-                    if ($this->attachment->filename) {
+                    if (!empty($this->attachment->filename)
+                            && (StatusNet::isAjax() || common_config('attachments', 'show_html'))) {
                         // Locally-uploaded HTML. Scrub and display inline.
                         $this->showHtmlFile($this->attachment);
                         break;
@@ -211,7 +215,7 @@ class AttachmentListItem extends Widget
             $scripts[] = $script;
         }
         foreach ($scripts as $script) {
-            common_log(LOG_DEBUG, $script->textContent);
+            common_debug($script->textContent);
             $script->parentNode->removeChild($script);
         }