WP_Image_Editor_GD::stream() public WP 3.5.0
Returns stream of current image.
{} It's a method of the class: WP_Image_Editor_GD{}
No Hooks.
Return
true/false. True on success, false on failure.
Usage
$WP_Image_Editor_GD = new WP_Image_Editor_GD(); $WP_Image_Editor_GD->stream( $mime_type );
- $mime_type(string)
- The mime type of the image.
Default: null
Changelog
Since 3.5.0 | Introduced. |
Code of WP_Image_Editor_GD::stream() WP Image Editor GD::stream WP 5.6
public function stream( $mime_type = null ) {
list( $filename, $extension, $mime_type ) = $this->get_output_format( null, $mime_type );
switch ( $mime_type ) {
case 'image/png':
header( 'Content-Type: image/png' );
return imagepng( $this->image );
case 'image/gif':
header( 'Content-Type: image/gif' );
return imagegif( $this->image );
default:
header( 'Content-Type: image/jpeg' );
return imagejpeg( $this->image, null, $this->get_quality() );
}
}