summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorBrion Vibber <brion@status.net>2010-11-08 15:50:06 -0800
committerBrion Vibber <brion@status.net>2010-11-08 15:50:06 -0800
commita2994e3aa232106f39a6c36c9176608467b8822e (patch)
treeec5cbb136a47f0ef945072759d0a62805a63639a /lib
parent551b196a3572ac9dabcda47abc92db201fb0e6c9 (diff)
Testing... using photo info for temp thumbnails
Diffstat (limited to 'lib')
-rw-r--r--lib/attachmentlist.php17
1 files changed, 14 insertions, 3 deletions
diff --git a/lib/attachmentlist.php b/lib/attachmentlist.php
index f29d32ada..8e6ad038a 100644
--- a/lib/attachmentlist.php
+++ b/lib/attachmentlist.php
@@ -212,19 +212,30 @@ class AttachmentListItem extends Widget
}
}
+ /**
+ * Pull a thumbnail image reference for the given file.
+ * In order we check:
+ * 1) file_thumbnail table (thumbnails found via oEmbed)
+ * 2) image URL from direct dereference or oEmbed 'photo' type URL
+ * 3) ???
+ *
+ * @return mixed object with (url, width, height) properties, or false
+ */
function getThumbInfo()
{
$thumbnail = File_thumbnail::staticGet('file_id', $this->attachment->id);
if ($thumbnail) {
return $thumbnail;
- } else {
- switch ($this->attachment->mimetype) {
+ }
+ $enc = $this->attachment->getEnclosure();
+ if ($enc) {
+ switch ($enc->mimetype) {
case 'image/gif':
case 'image/png':
case 'image/jpg':
case 'image/jpeg':
$thumb = (object)array();
- $thumb->url = $this->attachment->url;
+ $thumb->url = $enc->url;
$thumb->width = 100;
$thumb->height = 75; // @fixme
return $thumb;