public function output($image_type = null, $quality = null)
{
$image_type = $image_type ?: $this->source_type;
header('Content-Type: ' . image_type_to_mime_type($image_type));
$this->save(null, $image_type, $quality);
}
public function testOutputPng() { $image = $this->createImage(200, 100, 'png'); $resize = new ImageResize($image); ob_start(); // supressing header errors @$resize->output(); $image_contents = ob_get_clean(); $info = finfo_open(); $type = finfo_buffer($info, $image_contents, FILEINFO_MIME_TYPE); $this->assertEquals('image/png', $type); }