Docs: Improve documentation for WP_Image_Editor::save() and related functions.

Includes:
* Documenting the returned array using hash notation.
* Adding a `@since` note for the `$filesize` value being included in the returned array.

This affects:
 * `wp_generate_attachment_metadata()`
 * `wp_get_attachment_metadata()`
 * `WP_Image_Editor::save()`
 * `WP_Image_Editor_GD::save()` and `::_save()`
 * `WP_Image_Editor_Imagick::save()` and `::_save()`

Follow-up to [22094], [22619], [52837], [53546].

See #55646.

git-svn-id: https://develop.svn.wordpress.org/trunk@53547 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Sergey Biryukov
2022-06-21 11:16:09 +00:00
parent d27deea511
commit a14324ca3a
5 changed files with 65 additions and 8 deletions

View File

@@ -190,6 +190,7 @@ function wp_update_image_subsizes( $attachment_id ) {
* Updates the attached file and image meta data when the original image was edited.
*
* @since 5.3.0
* @since 6.0.0 The `$filesize` value was added to the returned array.
* @access private
*
* @param array $saved_data The data returned from WP_Image_Editor after successfully saving an image.
@@ -211,12 +212,12 @@ function _wp_image_meta_replace_original( $saved_data, $original_file, $image_me
// Make the file path relative to the upload dir.
$image_meta['file'] = _wp_relative_upload_path( $new_file );
// Store the original image file name in image_meta.
$image_meta['original_image'] = wp_basename( $original_file );
// Add image file size.
$image_meta['filesize'] = wp_filesize( $new_file );
// Store the original image file name in image_meta.
$image_meta['original_image'] = wp_basename( $original_file );
return $image_meta;
}
@@ -477,6 +478,7 @@ function _wp_make_subsizes( $new_sizes, $file, $image_meta, $attachment_id ) {
* Generate attachment meta data and create image sub-sizes for images.
*
* @since 2.1.0
* @since 6.0.0 The `$filesize` value was added to the returned array.
*
* @param int $attachment_id Attachment ID to process.
* @param string $file Filepath of the attached image.