public function blob($type = 'PNG')
{
$type = strtoupper($type);
if (ImageType::GIF == $type) {
imagegif($this->gd);
} else {
if (ImageType::JPEG == $type) {
imagejpeg($this->gd);
} else {
if (ImageType::PNG == $type) {
imagepng($this->gd);
} else {
if (ImageType::WBMP == $type) {
imagewbmp($this->gd);
} else {
throw new \Exception(sprintf('File type "%s" not supported.', $type));
}
}
}
}
}