Make WordPress Core


Ignore:
Timestamp:
09/20/2020 04:21:42 PM (5 years ago)
Author:
johnbillion
Message:

Media: Standardise the description for image size parameters.

This brings continuity to all the image related functions and filters which accept or pass a size parameter.

Props dilipbheda, johnbillion

Fixes #47364

File:
1 edited

Legend:

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

    r49020 r49021  
    4747 * @param int          $width   Width of the image in pixels.
    4848 * @param int          $height  Height of the image in pixels.
    49  * @param string|array $size    Optional. Image size. Accepts any valid image size, or an array
    50  *                              of width and height values in pixels (in that order).
    51  *                              Default 'medium'.
     49 * @param string|int[] $size    Optional. Image size. Accepts any registered image size name, or an array
     50 *                              of width and height values in pixels (in that order). Default 'medium'.
    5251 * @param string       $context Optional. Could be 'display' (like in a theme) or 'edit'
    5352 *                              (like inserting into an editor). Default null.
     
    126125     *     @type int $1 The maximum height in pixels.
    127126     * }
    128      * @param string|array $size           Size of what the result image should be.
    129      * @param string       $context        The context the image is being resized for.
    130      *                                     Possible values are 'display' (like in a theme)
    131      *                                     or 'edit' (like inserting into an editor).
     127     * @param string|int[] $size     Requested image size. Can be any registered image size name, or
     128     *                               an array of width and height values in pixels (in that order).
     129     * @param string       $context  The context the image is being resized for.
     130     *                               Possible values are 'display' (like in a theme)
     131     *                               or 'edit' (like inserting into an editor).
    132132     */
    133133    list( $max_width, $max_height ) = apply_filters( 'editor_max_image_size', array( $max_width, $max_height ), $size, $context );
     
    178178 *
    179179 * @param int          $id   Attachment ID for image.
    180  * @param string|int[] $size Optional. Image size to scale to. Accepts any valid image size name,
    181  *                           or an array of width and height values in pixels (in that order).
    182  *                           Default 'medium'.
     180 * @param string|int[] $size Optional. Image size. Accepts any registered image size name, or an array
     181 *                           of width and height values in pixels (in that order). Default 'medium'.
    183182 * @return array|false {
    184183 *     Array of image data, or boolean false if no image is available.
     
    203202     * @param bool|array   $downsize Whether to short-circuit the image downsize.
    204203     * @param int          $id       Attachment ID for image.
    205      * @param array|string $size     Requested size of image. Image size name, or array of width
    206      *                               and height values (in that order).
     204     * @param string|int[] $size     Requested image size. Can be any registered image size name, or
     205     *                               an array of width and height values in pixels (in that order).
    207206     */
    208207    $out = apply_filters( 'image_downsize', false, $id, $size );
     
    368367 * @param string       $title Image description for the title attribute.
    369368 * @param string       $align Part of the class name for aligning the image.
    370  * @param string|array $size  Optional. Registered image size to retrieve a tag for. Accepts any
    371  *                            valid image size, or an array of width and height values in pixels
    372  *                            (in that order). Default 'medium'.
     369 * @param string|int[] $size  Optional. Image size. Accepts any registered image size name, or an array of
     370 *                           width and height values in pixels (in that order). Default 'medium'.
    373371 * @return string HTML IMG element for given image attachment
    374372 */
     
    390388     * @param int          $id    Attachment ID.
    391389     * @param string       $align Part of the class name for aligning the image.
    392      * @param string|array $size  Size of image. Image size or array of width and height values (in that order).
    393      *                            Default 'medium'.
     390     * @param string|int[] $size  Requested image size. Can be any registered image size name, or
     391     *                            an array of width and height values in pixels (in that order).
    394392     */
    395393    $class = apply_filters( 'get_image_tag_class', $class, $id, $align, $size );
     
    407405     * @param string       $title Image description for the title attribute.
    408406     * @param string       $align Part of the class name for aligning the image.
    409      * @param string|array $size  Size of image. Image size or array of width and height values (in that order).
    410      *                            Default 'medium'.
     407     * @param string|int[] $size  Requested image size. Can be any registered image size name, or
     408     *                            an array of width and height values in pixels (in that order).
    411409     */
    412410    return apply_filters( 'get_image_tag', $html, $id, $alt, $title, $align, $size );
     
    745743 *
    746744 * @param int          $post_id Attachment ID.
    747  * @param array|string $size    Optional. Image size. Accepts any valid image size, or an array
    748  *                              of width and height values in pixels (in that order).
    749  *                              Default 'thumbnail'.
     745 * @param string|int[] $size    Optional. Image size. Accepts any registered image size name, or an array
     746 *                              of width and height values in pixels (in that order). Default 'thumbnail'.
    750747 * @return array|false {
    751748 *     Array of file relative path, width, and height on success. Additionally includes absolute
     
    845842     * @param array        $data    Array of file relative path, width, and height on success. May also include
    846843     *                              file absolute path and URL.
    847      * @param int          $post_id The post_id of the image attachment
    848      * @param string|array $size    Registered image size or flat array of initially-requested height and width
    849      *                              dimensions (in that order).
     844     * @param int          $post_id The ID of the image attachment.
     845     * @param string|int[] $size    Requested image size. Can be any registered image size name, or
     846     *                              an array of width and height values in pixels (in that order).
    850847     */
    851848    return apply_filters( 'image_get_intermediate_size', $data, $post_id, $size );
     
    939936 *
    940937 * @param int          $attachment_id Image attachment ID.
    941  * @param string|int[] $size          Optional. Image size. Accepts any valid image size name, or an array of width
    942  *                                    and height values in pixels (in that order). Default 'thumbnail'.
     938 * @param string|int[] $size          Optional. Image size. Accepts any registered image size name, or an array of
     939 *                                    width and height values in pixels (in that order). Default 'thumbnail'.
    943940 * @param bool         $icon          Optional. Whether the image should fall back to a mime type icon. Default false.
    944941 * @return array|false {
     
    987984     * }
    988985     * @param int          $attachment_id Image attachment ID.
    989      * @param string|int[] $size          Requested size of image. Image size name, or array of width
    990      *                                    and height values (in that order).
     986     * @param string|int[] $size          Requested image size. Can be any registered image size name, or
     987     *                                    an array of width and height values in pixels (in that order).
    991988     * @param bool         $icon          Whether the image should be treated as an icon.
    992989     */
     
    10071004 *
    10081005 * @param int          $attachment_id Image attachment ID.
    1009  * @param string|array $size          Optional. Image size. Accepts any valid image size, or an array of width
    1010  *                                    and height values in pixels (in that order). Default 'thumbnail'.
     1006 * @param string|int[] $size          Optional. Image size. Accepts any registered image size name, or an array
     1007 *                                    of width and height values in pixels (in that order). Default 'thumbnail'.
    10111008 * @param bool         $icon          Optional. Whether the image should be treated as an icon. Default false.
    10121009 * @param string|array $attr {
     
    10871084         *                                 See wp_get_attachment_image().
    10881085         * @param WP_Post      $attachment Image attachment post.
    1089          * @param string|array $size       Requested size. Image size or array of width and height values
    1090          *                                 (in that order). Default 'thumbnail'.
     1086         * @param string|int[] $size       Requested image size. Can be any registered image size name, or
     1087         *                                 an array of width and height values in pixels (in that order).
    10911088         */
    10921089        $attr = apply_filters( 'wp_get_attachment_image_attributes', $attr, $attachment, $size );
     
    11111108 *
    11121109 * @param int          $attachment_id Image attachment ID.
    1113  * @param string|array $size          Optional. Image size to retrieve. Accepts any valid image size, or an array
    1114  *                                    of width and height values in pixels (in that order). Default 'thumbnail'.
     1110 * @param string|int[] $size          Optional. Image size. Accepts any registered image size name, or an array of
     1111 *                                    width and height values in pixels (in that order). Default 'thumbnail'.
    11151112 * @param bool         $icon          Optional. Whether the image should be treated as an icon. Default false.
    11161113 * @return string|false Attachment URL or false if no image is available.
     
    11871184 *
    11881185 * @param int          $attachment_id Image attachment ID.
    1189  * @param array|string $size          Optional. Image size. Accepts any valid image size, or an array of
     1186 * @param string|int[] $size          Optional. Image size. Accepts any registered image size name, or an array of
    11901187 *                                    width and height values in pixels (in that order). Default 'medium'.
    11911188 * @param array        $image_meta    Optional. The image meta data as returned by 'wp_get_attachment_metadata()'.
     
    14281425 *
    14291426 * @param int          $attachment_id Image attachment ID.
    1430  * @param array|string $size          Optional. Image size. Accepts any valid image size, or an array of width
    1431  *                                    and height values in pixels (in that order). Default 'medium'.
     1427 * @param string|int[] $size          Optional. Image size. Accepts any registered image size name, or an array of
     1428 *                                    width and height values in pixels (in that order). Default 'medium'.
    14321429 * @param array        $image_meta    Optional. The image meta data as returned by 'wp_get_attachment_metadata()'.
    14331430 *                                    Default null.
     
    14591456 * @since 4.4.0
    14601457 *
    1461  * @param array|string $size          Image size to retrieve. Accepts any valid image size, or an array
    1462  *                                    of width and height values in pixels (in that order). Default 'medium'.
     1458 * @param string|int[] $size          Image size. Accepts any registered image size name, or an array of
     1459 *                                    width and height values in pixels (in that order).
    14631460 * @param string       $image_src     Optional. The URL to the image file. Default null.
    14641461 * @param array        $image_meta    Optional. The image meta data as returned by 'wp_get_attachment_metadata()'.
     
    14991496     *
    15001497     * @param string       $sizes         A source size value for use in a 'sizes' attribute.
    1501      * @param array|string $size          Requested size. Image size or array of width and height values
    1502      *                                    in pixels (in that order).
     1498     * @param string|int[] $size          Requested image size. Can be any registered image size name, or
     1499     *                                    an array of width and height values in pixels (in that order).
    15031500     * @param string|null  $image_src     The URL to the image file or null.
    15041501     * @param array|null   $image_meta    The image meta data as returned by wp_get_attachment_metadata() or null.
     
    21552152 *                                    Default 'dd', or 'figcaption' when the theme registers HTML5 gallery support.
    21562153 *     @type int          $columns    Number of columns of images to display. Default 3.
    2157  *     @type string|array $size       Size of the images to display. Accepts any valid image size, or an array of width
    2158  *                                    and height values in pixels (in that order). Default 'thumbnail'.
     2154 *     @type string|int[] $size       Size of the images to display. Accepts any registered image size name, or an array
     2155 *                                    of width and height values in pixels (in that order). Default 'thumbnail'.
    21592156 *     @type string       $ids        A comma-separated list of IDs of attachments to display. Default empty.
    21602157 *     @type string       $include    A comma-separated list of IDs of attachments to include. Default empty.
     
    32833280 * @see adjacent_image_link()
    32843281 *
    3285  * @param string|array $size Optional. Image size. Accepts any valid image size, an array of width and
    3286  *                           height values in pixels (in that order), 0, or 'none'. 0 or 'none' will
    3287  *                           default to 'post_title' or `$text`. Default 'thumbnail'.
     3282 * @param string|int[] $size Optional. Image size. Accepts any registered image size name, or an array
     3283 *                           of width and height values in pixels (in that order). Default 'thumbnail'.
    32883284 * @param string       $text Optional. Link text. Default false.
    32893285 */
     
    32993295 * @see adjacent_image_link()
    33003296 *
    3301  * @param string|array $size Optional. Image size. Accepts any valid image size, an array of width and
    3302  *                           height values in pixels (in that order), 0, or 'none'. 0 or 'none' will
    3303  *                           default to 'post_title' or `$text`. Default 'thumbnail'.
     3297 * @param string|int[] $size Optional. Image size. Accepts any registered image size name, or an array
     3298 *                           of width and height values in pixels (in that order). Default 'thumbnail'.
    33043299 * @param string       $text Optional. Link text. Default false.
    33053300 */
     
    33163311 *
    33173312 * @param bool         $prev Optional. Whether to display the next (false) or previous (true) link. Default true.
    3318  * @param string|array $size Optional. Image size. Accepts any valid image size, or an array of width and height
    3319  *                           values in pixels (in that order). Default 'thumbnail'.
     3313 * @param string|int[] $size Optional. Image size. Accepts any registered image size name, or an array
     3314 *                           of width and height values in pixels (in that order). Default 'thumbnail'.
    33203315 * @param bool         $text Optional. Link text. Default false.
    33213316 */
     
    33653360     * @param string $output        Adjacent image HTML markup.
    33663361     * @param int    $attachment_id Attachment ID
    3367      * @param string $size          Image size.
     3362     * @param string|int[] $size    Requested image size. Can be any registered image size name, or
     3363     *                              an array of width and height values in pixels (in that order).
    33683364     * @param string $text          Link text.
    33693365     */
Note: See TracChangeset for help on using the changeset viewer.