<?php ob_get_contents(): string|false
<?php ob_start(); imagejpeg($this->image->getCore(), null, $this->quality); $this->image->mime = image_type_to_mime_type(IMAGETYPE_JPEG); $buffer = ob_get_contents(); ob_end_clean(); return $buffer;
<?php imagesavealpha($resource, true); imagepng($resource, null, -1); $this->image->mime = image_type_to_mime_type(IMAGETYPE_PNG); $buffer = ob_get_contents(); ob_end_clean(); return $buffer;
<?php ob_start(); imagegif($this->image->getCore()); $this->image->mime = image_type_to_mime_type(IMAGETYPE_GIF); $buffer = ob_get_contents(); ob_end_clean(); return $buffer;
<?php imagesavealpha($this->image->getCore(), true); imagewebp($this->image->getCore(), null, $this->quality); $this->image->mime = defined('IMAGETYPE_WEBP') ? image_type_to_mime_type(IMAGETYPE_WEBP) : 'image/webp'; $buffer = ob_get_contents(); ob_end_clean(); return $buffer;
<?php ob_start(); imagebmp($this->image->getCore()); $this->image->mime = defined('IMAGETYPE_BMP') ? image_type_to_mime_type(IMAGETYPE_BMP) : 'image/bmp'; $buffer = ob_get_contents(); ob_end_clean(); return $buffer;