loaded) { return ""; } if ($item->type == "photo") { $view = new View("quick_edit.html"); $view->item = $item; print $view; } } public function rotate($id, $dir) { access::verify_csrf(); $item = ORM::factory("item", $id); if (!$item->loaded) { return ""; } $degrees = 0; switch($dir) { case "ccw": $degrees = -90; break; case "cw": $degrees = 90; break; } if ($degrees) { graphics::rotate($item->file_path(), $item->file_path(), array("degrees" => $degrees)); list($item->width, $item->height) = getimagesize($item->file_path()); $item->resize_dirty= 1; $item->thumb_dirty= 1; $item->save(); graphics::generate($item); } print json_encode( array("src" => $item->thumb_url() . "?rnd=" . rand(), "width" => $item->thumb_width, "height" => $item->thumb_height)); } }