Grafika\Gd\Image::blob PHP Method

blob() public method

Output a binary raw dump of an image in a specified format.
public blob ( string | ImageType $type = 'PNG' )
$type string | Grafika\ImageType Image format of the dump.
    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));
                    }
                }
            }
        }
    }