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;
}