diff options
author | Bharat Mediratta <bharat@menalto.com> | 2013-01-19 22:26:34 -0800 |
---|---|---|
committer | Bharat Mediratta <bharat@menalto.com> | 2013-01-19 22:26:34 -0800 |
commit | 52ab0e99884e6f018e540c3c64cb877fd608cef6 (patch) | |
tree | 179e6331f0ecbb8f3b38a6b728abb6ebf3fda0b7 | |
parent | 2c584d5d23a346b085259a717055fbbb6c737da4 (diff) | |
parent | 592eff0e5a8af6f74eff4806dc6e7de56ca02761 (diff) |
Merge pull request #89 from shadlaws/fix_1942
#1942 - Make data_rest and file_proxy more consistent
-rw-r--r-- | modules/gallery/controllers/file_proxy.php | 3 | ||||
-rw-r--r-- | modules/gallery/helpers/data_rest.php | 20 |
2 files changed, 10 insertions, 13 deletions
diff --git a/modules/gallery/controllers/file_proxy.php b/modules/gallery/controllers/file_proxy.php index b9ff7df1..9af58c0c 100644 --- a/modules/gallery/controllers/file_proxy.php +++ b/modules/gallery/controllers/file_proxy.php @@ -100,6 +100,9 @@ class File_Proxy_Controller extends Controller { throw new Kohana_404_Exception(); } + // Note: this code is roughly duplicated in data_rest, so if you modify this, please look to + // see if you should make the same change there as well. + if ($type == "albums") { $file = $item->file_path(); } else if ($type == "resizes") { diff --git a/modules/gallery/helpers/data_rest.php b/modules/gallery/helpers/data_rest.php index 343975f6..abd4638e 100644 --- a/modules/gallery/helpers/data_rest.php +++ b/modules/gallery/helpers/data_rest.php @@ -32,27 +32,21 @@ class data_rest_Core { throw new Rest_Exception("Bad Request", 400, array("errors" => array("size" => "invalid"))); } - switch ($p->size) { - case "thumb": - $file = $item->thumb_path(); - break; - - case "resize": - $file = $item->resize_path(); - break; + // Note: this code is roughly duplicated in file_proxy, so if you modify this, please look to + // see if you should make the same change there as well. - case "full": + if ($p->size == "full") { $file = $item->file_path(); - break; + } else if ($p->size == "resize") { + $file = $item->resize_path(); + } else { + $file = $item->thumb_path(); } if (!file_exists($file)) { throw new Kohana_404_Exception(); } - // Note: this code is roughly duplicated in data_rest, so if you modify this, please look to - // see if you should make the same change there as well. - // // We don't have a cache buster in the url, so don't set cache headers here. // We don't need to save the session for this request Session::instance()->abort_save(); |