W3cubDocs

/WordPress

WP_Image_Editor::save( string $destfilename = null, string $mime_type = null ): array|WP_Error

Saves current image to file.

Parameters

$destfilenamestringoptional
Destination filename.

Default:null

$mime_typestringoptional
The mime-type.

Default:null

Return

array|WP_Error Array on success or WP_Error if the file failed to save.
  • path string
    Path to the image file.
  • file string
    Name of the image file.
  • width int
    Image width.
  • height int
    Image height.
  • mime-type string
    The mime type of the image.
  • filesize int
    File size of the image.

Source

abstract public function save( $destfilename = null, $mime_type = null );

Changelog

Version Description
6.0.0 The $filesize value was added to the returned array.
3.5.0 Introduced.

© 2003–2024 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/classes/wp_image_editor/save