From 592eff0e5a8af6f74eff4806dc6e7de56ca02761 Mon Sep 17 00:00:00 2001 From: shadlaws Date: Sat, 19 Jan 2013 08:40:19 +0100 Subject: #1942 - Make data_rest and file_proxy more consistent - several minor documentation/formatting changes. No actual functionality changed here. --- modules/gallery/helpers/data_rest.php | 20 +++++++------------- 1 file changed, 7 insertions(+), 13 deletions(-) (limited to 'modules/gallery/helpers') 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(); -- cgit v1.2.3