UseFileAsThumbnailException (helps support GIFs)

This commit is contained in:
Mikael Nordfeldth
2014-06-17 11:54:05 +02:00
parent 19e80a60df
commit 5a3d74d9a8
5 changed files with 60 additions and 1 deletions

View File

@@ -58,7 +58,12 @@ class Attachment_thumbnailAction extends AttachmentAction
function showPage()
{
// Returns a File_thumbnail object or throws exception if not available
$thumbnail = $this->attachment->getThumbnail($this->thumb_w, $this->thumb_h, $this->thumb_c);
try {
$thumbnail = $this->attachment->getThumbnail($this->thumb_w, $this->thumb_h, $this->thumb_c);
} catch (UseFileAsThumbnailException $e) {
// Since we're only using the ->getUrl() function, we can use the File object
$thumbnail = $e->file;
}
common_redirect($thumbnail->getUrl());
}
}