summaryrefslogtreecommitdiff
path: root/modules/gallery/helpers/data_rest.php
diff options
context:
space:
mode:
Diffstat (limited to 'modules/gallery/helpers/data_rest.php')
-rw-r--r--modules/gallery/helpers/data_rest.php21
1 files changed, 10 insertions, 11 deletions
diff --git a/modules/gallery/helpers/data_rest.php b/modules/gallery/helpers/data_rest.php
index ef4f17e7..dc213510 100644
--- a/modules/gallery/helpers/data_rest.php
+++ b/modules/gallery/helpers/data_rest.php
@@ -1,7 +1,7 @@
<?php defined("SYSPATH") or die("No direct script access.");
/**
* Gallery - a web based photo album viewer and editor
- * Copyright (C) 2000-2012 Bharat Mediratta
+ * Copyright (C) 2000-2013 Bharat Mediratta
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -51,24 +51,23 @@ 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 or album, then its thumbnail will be a JPG.
if (($item->is_movie() || $item->is_album()) && $p->size == "thumb") {
header("Content-Type: image/jpeg");
} else {
header("Content-Type: $item->mime_type");
}
- Kohana::close_buffers(false);
- if (isset($p->encoding) && $p->encoding == "base64") {
- print base64_encode(file_get_contents($file));
+ if (TEST_MODE) {
+ return $file;
} else {
- readfile($file);
+ Kohana::close_buffers(false);
+
+ if (isset($p->encoding) && $p->encoding == "base64") {
+ print base64_encode(file_get_contents($file));
+ } else {
+ readfile($file);
+ }
}
// We must exit here to keep the regular REST framework reply code from adding more bytes on