/** * Retrieve single image information. * * /images/id/1 - get image with ID = 1 */ function id_get() { header('Access-Control-Allow-Origin: *'); $id = $this->uri->segment(3); $imageModel = new ImageModel($this->db); $image = $imageModel->getImageById($id); if ($image == null) { $this->response(error('Image not found.', 404), 404); } else { $this->response($image->serialize()); } }