Make WordPress Core

Changeset 46376


Ignore:
Timestamp:
10/03/2019 02:46:46 PM (5 years ago)
Author:
joemcgill
Message:

Media: Improve documentation for add_image_size()

This improves the description of the $crop parameter to clarify behavior.

Props nikolastoqnow, ketuchetan, audrasjb, killua99, pierlo.
Fixes #42463.

File:
1 edited

Legend:

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

    r46375 r46376  
    269269 * Register a new image size.
    270270 *
    271  * Cropping behavior for the image size is dependent on the value of $crop:
    272  * 1. If false (default), images will be scaled, not cropped.
    273  * 2. If an array in the form of array( x_crop_position, y_crop_position ):
    274  *    - x_crop_position accepts 'left' 'center', or 'right'.
    275  *    - y_crop_position accepts 'top', 'center', or 'bottom'.
    276  *    Images will be cropped to the specified dimensions within the defined crop area.
    277  * 3. If true, images will be cropped to the specified dimensions using center positions.
    278  *
    279271 * @since 2.9.0
    280272 *
     
    284276 * @param int        $width  Optional. Image width in pixels. Default 0.
    285277 * @param int        $height Optional. Image height in pixels. Default 0.
    286  * @param bool|array $crop   Optional. Whether to crop images to specified width and height or resize.
    287  *                           An array can specify positioning of the crop area. Default false.
     278 * @param bool|array $crop   Optional. Image cropping behavior. If false, the image will be scaled (default),
     279 *                           If true, image will be cropped to the specified dimensions using center positions.
     280 *                           If an array, the image will be cropped using the array to specify the crop location.
     281 *                           Array values must be in the format: array( x_crop_position, y_crop_position ) where:
     282 *                               - x_crop_position accepts: 'left', 'center', or 'right'.
     283 *                               - y_crop_position accepts: 'top', 'center', or 'bottom'.
    288284 */
    289285function add_image_size( $name, $width = 0, $height = 0, $crop = false ) {
Note: See TracChangeset for help on using the changeset viewer.