WP_Image_Editor_GD::stream

Advertisement

Summery Summery

Returns stream of current image.

Syntax Syntax

WP_Image_Editor_GD::stream( string $mime_type = null )

Parameters Parameters

$mime_type

(Optional) The mime type of the image.

Default value: null

Return Return

(bool) True on success, false on failure.

Source Source

File: wp-includes/class-wp-image-editor-gd.php

	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() );
		}
	}

Advertisement

Changelog Changelog

Changelog
Version Description
3.5.0 Introduced.

Advertisement

Leave a Reply