diff options
author | Bharat Mediratta <bharat@menalto.com> | 2010-08-14 22:00:53 -0700 |
---|---|---|
committer | Bharat Mediratta <bharat@menalto.com> | 2010-08-14 22:00:53 -0700 |
commit | 6563ad1393b6d9a9cde44a127355359edae54843 (patch) | |
tree | 4f38e1332113f0c6c442e59bd7b112ff1c49d91b /modules/gallery/helpers/data_rest.php | |
parent | dbe595f15e9c3f359fa447cf270e914b6d6d809e (diff) |
Return the right content type for album thumbnails (based on the album cover's mime type)
Diffstat (limited to 'modules/gallery/helpers/data_rest.php')
-rw-r--r-- | modules/gallery/helpers/data_rest.php | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/modules/gallery/helpers/data_rest.php b/modules/gallery/helpers/data_rest.php index 3cd2f59a..98c98894 100644 --- a/modules/gallery/helpers/data_rest.php +++ b/modules/gallery/helpers/data_rest.php @@ -57,9 +57,17 @@ class data_rest_Core { // We don't need to save the session for this request Session::instance()->abort_save(); + if ($item->is_album() && !$item->album_cover_item_id) { + // No thumbnail. Return nothing. + // @todo: what should we do here? + return; + } + // Dump out the image. If the item is a movie, then its thumbnail will be a JPG. if ($item->is_movie() && $p->size == "thumb") { header("Content-Type: image/jpeg"); + } else if ($item->is_album()) { + header("Content-Type: " . $item->album_cover()->mime_type); } else { header("Content-Type: {$item->mime_type}"); } |