WP_Image_Editor_Imagick::stream()
Streams current image to browser.
Метод класса: WP_Image_Editor_Imagick{}
Хуков нет.
Возвращает
true|WP_Error
. True on success, WP_Error object on failure.
Использование
$WP_Image_Editor_Imagick = new WP_Image_Editor_Imagick(); $WP_Image_Editor_Imagick->stream( $mime_type );
- $mime_type(строка)
- The mime type of the image.
По умолчанию: null
Список изменений
С версии 3.5.0 | Введена. |
Код WP_Image_Editor_Imagick::stream() WP Image Editor Imagick::stream WP 6.6.2
public function stream( $mime_type = null ) { list( $filename, $extension, $mime_type ) = $this->get_output_format( null, $mime_type ); try { // Temporarily change format for stream. $this->image->setImageFormat( strtoupper( $extension ) ); // Output stream of image content. header( "Content-Type: $mime_type" ); print $this->image->getImageBlob(); // Reset image to original format. $this->image->setImageFormat( $this->get_extension( $this->mime_type ) ); } catch ( Exception $e ) { return new WP_Error( 'image_stream_error', $e->getMessage() ); } return true; }