Make WordPress Core

Changeset 47394


Ignore:
Timestamp:
02/29/2020 04:47:44 PM (5 years ago)
Author:
johnbillion
Message:

Docs: Correct and improve the docs for some media related functions.

See #48303

Location:
trunk/src/wp-includes
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/media.php

    r47249 r47394  
    167167 * Scale an image to fit a particular size (such as 'thumb' or 'medium').
    168168 *
    169  * Array with image url, width, height, and whether is intermediate size, in
    170  * that order is returned on success is returned. $is_intermediate is true if
    171  * $url is a resized image, false if it is the original.
    172  *
    173169 * The URL might be the original image, or it might be a resized version. This
    174170 * function won't create a new resized copy, it will just return an already
     
    177173 * A plugin may use the {@see 'image_downsize'} filter to hook into and offer image
    178174 * resizing services for images. The hook must return an array with the same
    179  * elements that are returned in the function. The first element being the URL
    180  * to the new image that was resized.
     175 * elements that are normally returned from the function.
    181176 *
    182177 * @since 2.5.0
    183178 *
    184179 * @param int          $id   Attachment ID for image.
    185  * @param array|string $size Optional. Image size to scale to. Accepts any valid image size,
     180 * @param string|int[] $size Optional. Image size to scale to. Accepts any valid image size name,
    186181 *                           or an array of width and height values in pixels (in that order).
    187182 *                           Default 'medium'.
    188  * @return array|false Array containing the image URL, width, height, and boolean for whether
    189  *                     the image is an intermediate size. False on failure.
     183 * @return array|false {
     184 *     Array of image data, or boolean false if no image is available.
     185 *
     186 *     @type string $0 Image source URL.
     187 *     @type int    $1 Image width in pixels.
     188 *     @type int    $2 Image height in pixels.
     189 *     @type bool   $3 Whether the image is a resized image.
     190 * }
    190191 */
    191192function image_downsize( $id, $size = 'medium' ) {
     
    195196     * Filters whether to preempt the output of image_downsize().
    196197     *
    197      * Passing a truthy value to the filter will effectively short-circuit
    198      * down-sizing the image, returning that value as output instead.
     198     * Returning a truthy value from the filter will effectively short-circuit
     199     * down-sizing the image, returning that value instead.
    199200     *
    200201     * @since 2.5.0
    201202     *
    202      * @param bool         $downsize Whether to short-circuit the image downsize. Default false.
     203     * @param bool|array   $downsize Whether to short-circuit the image downsize.
    203204     * @param int          $id       Attachment ID for image.
    204      * @param array|string $size     Size of image. Image size or array of width and height values (in that order).
    205      *                               Default 'medium'.
     205     * @param array|string $size     Requested size of image. Image size name, or array of width
     206     *                               and height values (in that order).
    206207     */
    207208    $out = apply_filters( 'image_downsize', false, $id, $size );
     
    933934
    934935/**
    935  * Retrieve an image to represent an attachment.
    936  *
    937  * A mime icon for files, thumbnail or intermediate size for images.
    938  *
    939  * The returned array contains four values: the URL of the attachment image src,
    940  * the width of the image file, the height of the image file, and a boolean
    941  * representing whether the returned array describes an intermediate (generated)
    942  * image size or the original, full-sized upload.
     936 * Retrieves an image to represent an attachment.
    943937 *
    944938 * @since 2.5.0
    945939 *
    946940 * @param int          $attachment_id Image attachment ID.
    947  * @param string|array $size          Optional. Image size. Accepts any valid image size, or an array of width
     941 * @param string|int[] $size          Optional. Image size. Accepts any valid image size name, or an array of width
    948942 *                                    and height values in pixels (in that order). Default 'thumbnail'.
    949  * @param bool         $icon          Optional. Whether the image should be treated as an icon. Default false.
    950  * @return array|false Returns an array (url, width, height, is_intermediate), or false if no image is available.
     943 * @param bool         $icon          Optional. Whether the image should fall back to a mime type icon. Default false.
     944 * @return array|false {
     945 *     Array of image data, or boolean false if no image is available.
     946 *
     947 *     @type string $0 Image source URL.
     948 *     @type int    $1 Image width in pixels.
     949 *     @type int    $2 Image height in pixels.
     950 * }
    951951 */
    952952function wp_get_attachment_image_src( $attachment_id, $size = 'thumbnail', $icon = false ) {
     
    973973    }
    974974    /**
    975      * Filters the image src result.
     975     * Filters the attachment image source result.
    976976     *
    977977     * @since 4.3.0
    978978     *
    979      * @param array|false  $image         Either array with src, width & height, icon src, or false.
     979     * @param array|false  $image         {
     980     *     Array of image data, or boolean false if no image is available.
     981     *
     982     *     @type string $0 Image source URL.
     983     *     @type int    $1 Image width in pixels.
     984     *     @type int    $2 Image height in pixels.
     985     * }
    980986     * @param int          $attachment_id Image attachment ID.
    981      * @param string|array $size          Size of image. Image size or array of width and height values
    982      *                                    (in that order). Default 'thumbnail'.
    983      * @param bool         $icon          Whether the image should be treated as an icon. Default false.
     987     * @param string|int[] $size          Requested size of image. Image size name, or array of width
     988     *                                    and height values (in that order).
     989     * @param bool         $icon          Whether the image should be treated as an icon.
    984990     */
    985991    return apply_filters( 'wp_get_attachment_image_src', $image, $attachment_id, $size, $icon );
  • trunk/src/wp-includes/post.php

    r47358 r47394  
    60886088
    60896089/**
    6090  * Retrieve the icon for a MIME type.
     6090 * Retrieve the icon for a MIME type or attachment.
    60916091 *
    60926092 * @since 2.1.0
Note: See TracChangeset for help on using the changeset viewer.