WP_Image_Editor_Imagick::save
Saves current image to file.
Method of the class: WP_Image_Editor_Imagick{}
No Hooks.
Returns
Array|WP_Error. Array on success or WP_Error if the file failed to save.
Usage
$WP_Image_Editor_Imagick = new WP_Image_Editor_Imagick(); $WP_Image_Editor_Imagick->save( $destfilename, $mime_type );
- $destfilename(string)
- Destination filename.
Default:null - $mime_type(string)
- The mime-type.
Default:null
Changelog
| Since 3.5.0 | Introduced. |
| Since 6.0.0 | The $filesize value was added to the returned array. |
WP_Image_Editor_Imagick::save() WP Image Editor Imagick::save code WP 7.0
public function save( $destfilename = null, $mime_type = null ) {
$saved = $this->_save( $this->image, $destfilename, $mime_type );
if ( ! is_wp_error( $saved ) ) {
$this->file = $saved['path'];
$this->mime_type = $saved['mime-type'];
try {
$this->image->setImageFormat( strtoupper( $this->get_extension( $this->mime_type ) ) );
} catch ( Exception $e ) {
return new WP_Error( 'image_save_error', $e->getMessage(), $this->file );
}
}
return $saved;
}