/** * @return TuringImage **/ private function outputImage(ImageType $imageType) { $gdImageTypes = imagetypes(); switch ($imageType->getId()) { case ImageType::WBMP: if ($gdImageTypes & IMG_WBMP) { header("Content-type: image/vnd.wap.wbmp"); imagewbmp($this->imageId); break; } case ImageType::PNG: if ($gdImageTypes & IMG_PNG) { header("Content-type: image/png"); imagepng($this->imageId); break; } case ImageType::JPEG: if ($gdImageTypes & IMG_JPG) { header("Content-type: image/jpeg"); imagejpeg($this->imageId); break; } case ImageType::GIF: if ($gdImageTypes & IMG_GIF) { header("Content-type: image/gif"); imagegif($this->imageId); break; } default: throw new UnimplementedFeatureException('requesting non-supported format'); } return $this; }