/** * Output the image object directly. * * @param boolean $download * @return \Pop\Image\Gd */ public function output($download = false) { // Determine if the force download argument has been passed. $attach = $download ? 'attachment; ' : null; $headers = array('Content-type' => $this->mime, 'Content-disposition' => $attach . 'filename=' . $this->basename); $response = new \Pop\Http\Response(200, $headers); if ($_SERVER['SERVER_PORT'] == 443) { $response->setSslHeaders(); } if (null === $this->resource) { $this->createResource(); } if (null === $this->output) { $this->output = $this->resource; } // Create the image resource and output it $response->sendHeaders(); $this->createImage($this->output, null, $this->quality); // Destroy the image resource. $this->destroy(); return $this; }
/** * Event-based route error check * * @param \Pop\Mvc\Router $router * @return void */ public static function error($router) { $view = \Pop\Mvc\View::factory(__DIR__ . '/../../view/route.phtml', array('i18n' => \Phire\Table\Config::getI18n(), 'title' => 'Routing Error', 'msg' => ' <p>There was no controller assigned for this route.</p>')); $response = new \Pop\Http\Response(404); $response->setBody($view->render(true)); $response->send(); }
/** * Output the file object directly. * * @param boolean $download * @return \Pop\File\File */ public function output($download = false) { // Determine if the force download argument has been passed. $attach = $download ? 'attachment; ' : null; $headers = array('Content-type' => $this->mime, 'Content-disposition' => $attach . 'filename=' . $this->basename); $response = new \Pop\Http\Response(200, $headers, $this->read()); if (isset($_SERVER['SERVER_PORT']) && $_SERVER['SERVER_PORT'] == 443) { $response->setSslHeaders(); } $response->send(); return $this; }
/** * Output the image object directly. * * @param boolean $download * @return \Pop\Image\Imagick */ public function output($download = false) { // Determine if the force download argument has been passed. $attach = $download ? 'attachment; ' : null; $headers = array('Content-type' => $this->mime, 'Content-disposition' => $attach . 'filename=' . $this->basename); $response = new \Pop\Http\Response(200, $headers); if ($_SERVER['SERVER_PORT'] == 443) { $response->setSslHeaders(); } if (null !== $this->compression) { $this->resource->setImageCompression($this->compression); } if (null !== $this->quality) { $this->resource->setImageCompressionQuality($this->quality); } $response->sendHeaders(); echo $this->resource; return $this; }