Skip to content

Commit

Permalink
Return the right content type for album thumbnails (based on the albu…
Browse files Browse the repository at this point in the history
…m cover's mime type)
  • Loading branch information
bharat committed Aug 15, 2010
1 parent dbe595f commit 6563ad1
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions modules/gallery/helpers/data_rest.php
Expand Up @@ -57,9 +57,17 @@ static function get($request) {
// 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}");
}
Expand Down

0 comments on commit 6563ad1

Please sign in to comment.