Make WordPress Core


Ignore:
Timestamp:
06/21/2022 11:16:09 AM (3 years ago)
Author:
SergeyBiryukov
Message:

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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/class-wp-image-editor-imagick.php

    r53317 r53547  
    662662     *
    663663     * @since 3.5.0
     664     * @since 6.0.0 The `$filesize` value was added to the returned array.
    664665     *
    665666     * @param string $destfilename Optional. Destination filename. Default null.
    666667     * @param string $mime_type    Optional. The mime-type. Default null.
    667      * @return array|WP_Error {'path'=>string, 'file'=>string, 'width'=>int, 'height'=>int, 'mime-type'=>string}
     668     * @return array|WP_Error {
     669     *     Array on success or WP_Error if the file failed to save.
     670     *
     671     *     @type string $path      Path to the image file.
     672     *     @type string $file      Name of the image file.
     673     *     @type int    $width     Image width.
     674     *     @type int    $height    Image height.
     675     *     @type string $mime-type The mime type of the image.
     676     *     @type int    $filesize  File size of the image.
     677     * }
    668678     */
    669679    public function save( $destfilename = null, $mime_type = null ) {
     
    685695
    686696    /**
     697     * @since 3.5.0
     698     * @since 6.0.0 The `$filesize` value was added to the returned array.
     699     *
    687700     * @param Imagick $image
    688701     * @param string  $filename
    689702     * @param string  $mime_type
    690      * @return array|WP_Error
     703     * @return array|WP_Error {
     704     *     Array on success or WP_Error if the file failed to save.
     705     *
     706     *     @type string $path      Path to the image file.
     707     *     @type string $file      Name of the image file.
     708     *     @type int    $width     Image width.
     709     *     @type int    $height    Image height.
     710     *     @type string $mime-type The mime type of the image.
     711     *     @type int    $filesize  File size of the image.
     712     * }
    691713     */
    692714    protected function _save( $image, $filename = null, $mime_type = null ) {
Note: See TracChangeset for help on using the changeset viewer.