Make WordPress Core

Changeset 56416


Ignore:
Timestamp:
08/18/2023 05:54:41 PM (14 months ago)
Author:
johnbillion
Message:

Media: Standardise documentation of the $crop parameter for various media functions and methods.

See #58833

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

Legend:

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

    r56204 r56416  
    166166     * @param int|null   $max_w Image width.
    167167     * @param int|null   $max_h Image height.
    168      * @param bool|array $crop
     168     * @param bool|array $crop   {
     169     *     Optional. Image cropping behavior. If false, the image will be scaled (default),
     170     *     If true, image will be cropped to the specified dimensions using center positions.
     171     *     If an array, the image will be cropped using the array to specify the crop location:
     172     *
     173     *     @type string $0 The x crop position. Accepts 'left' 'center', or 'right'.
     174     *     @type string $1 The y crop position. Accepts 'top', 'center', or 'bottom'.
     175     * }
    169176     * @return true|WP_Error
    170177     */
     
    191198     * @param int        $max_w
    192199     * @param int        $max_h
    193      * @param bool|array $crop
     200     * @param bool|array $crop   {
     201     *     Optional. Image cropping behavior. If false, the image will be scaled (default),
     202     *     If true, image will be cropped to the specified dimensions using center positions.
     203     *     If an array, the image will be cropped using the array to specify the crop location:
     204     *
     205     *     @type string $0 The x crop position. Accepts 'left' 'center', or 'right'.
     206     *     @type string $1 The y crop position. Accepts 'top', 'center', or 'bottom'.
     207     * }
    194208     * @return resource|GdImage|WP_Error
    195209     */
  • trunk/src/wp-includes/class-wp-image-editor-imagick.php

    r56271 r56416  
    321321     * @param int|null   $max_w Image width.
    322322     * @param int|null   $max_h Image height.
    323      * @param bool|array $crop
     323     * @param bool|array $crop   {
     324     *     Optional. Image cropping behavior. If false, the image will be scaled (default),
     325     *     If true, image will be cropped to the specified dimensions using center positions.
     326     *     If an array, the image will be cropped using the array to specify the crop location:
     327     *
     328     *     @type string $0 The x crop position. Accepts 'left' 'center', or 'right'.
     329     *     @type string $1 The y crop position. Accepts 'top', 'center', or 'bottom'.
     330     * }
    324331     * @return true|WP_Error
    325332     */
  • trunk/src/wp-includes/class-wp-image-editor.php

    r56361 r56416  
    107107     * @param int|null   $max_w Image width.
    108108     * @param int|null   $max_h Image height.
    109      * @param bool|array $crop
     109     * @param bool|array $crop   {
     110     *     Optional. Image cropping behavior. If false, the image will be scaled (default),
     111     *     If true, image will be cropped to the specified dimensions using center positions.
     112     *     If an array, the image will be cropped using the array to specify the crop location:
     113     *
     114     *     @type string $0 The x crop position. Accepts 'left' 'center', or 'right'.
     115     *     @type string $1 The y crop position. Accepts 'top', 'center', or 'bottom'.
     116     * }
    110117     * @return true|WP_Error
    111118     */
  • trunk/src/wp-includes/media.php

    r56386 r56416  
    284284 * @param int        $width  Optional. Image width in pixels. Default 0.
    285285 * @param int        $height Optional. Image height in pixels. Default 0.
    286  * @param bool|array $crop   Optional. Image cropping behavior. If false, the image will be scaled (default),
    287  *                           If true, image will be cropped to the specified dimensions using center positions.
    288  *                           If an array, the image will be cropped using the array to specify the crop location.
    289  *                           Array values must be in the format: array( x_crop_position, y_crop_position ) where:
    290  *                               - x_crop_position accepts: 'left', 'center', or 'right'.
    291  *                               - y_crop_position accepts: 'top', 'center', or 'bottom'.
     286 * @param bool|array $crop   {
     287 *     Optional. Image cropping behavior. If false, the image will be scaled (default).
     288 *     If true, image will be cropped to the specified dimensions using center positions.
     289 *     If an array, the image will be cropped using the array to specify the crop location:
     290 *
     291 *     @type string $0 The x crop position. Accepts 'left' 'center', or 'right'.
     292 *     @type string $1 The y crop position. Accepts 'top', 'center', or 'bottom'.
     293 * }
    292294 */
    293295function add_image_size( $name, $width = 0, $height = 0, $crop = false ) {
     
    344346 * @param int        $width  Image width in pixels.
    345347 * @param int        $height Image height in pixels.
    346  * @param bool|array $crop   Optional. Whether to crop images to specified width and height or resize.
    347  *                           An array can specify positioning of the crop area. Default false.
     348 * @param bool|array $crop   {
     349 *     Optional. Image cropping behavior. If false, the image will be scaled (default),
     350 *     If true, image will be cropped to the specified dimensions using center positions.
     351 *     If an array, the image will be cropped using the array to specify the crop location:
     352 *
     353 *     @type string $0 The x crop position. Accepts 'left' 'center', or 'right'.
     354 *     @type string $1 The y crop position. Accepts 'top', 'center', or 'bottom'.
     355 * }
    348356 */
    349357function set_post_thumbnail_size( $width = 0, $height = 0, $crop = false ) {
     
    512520 * within a specified width and height.
    513521 *
    514  * Cropping behavior is dependent on the value of $crop:
    515  * 1. If false (default), images will not be cropped.
    516  * 2. If an array in the form of array( x_crop_position, y_crop_position ):
    517  *    - x_crop_position accepts 'left' 'center', or 'right'.
    518  *    - y_crop_position accepts 'top', 'center', or 'bottom'.
    519  *    Images will be cropped to the specified dimensions within the defined crop area.
    520  * 3. If true, images will be cropped to the specified dimensions using center positions.
    521  *
    522522 * @since 2.5.0
    523523 *
     
    526526 * @param int        $dest_w New width in pixels.
    527527 * @param int        $dest_h New height in pixels.
    528  * @param bool|array $crop   Optional. Whether to crop image to specified width and height or resize.
    529  *                           An array can specify positioning of the crop area. Default false.
     528 * @param bool|array $crop   {
     529 *     Optional. Image cropping behavior. If false, the image will be scaled (default).
     530 *     If true, image will be cropped to the specified dimensions using center positions.
     531 *     If an array, the image will be cropped using the array to specify the crop location:
     532 *
     533 *     @type string $0 The x crop position. Accepts 'left' 'center', or 'right'.
     534 *     @type string $1 The y crop position. Accepts 'top', 'center', or 'bottom'.
     535 * }
    530536 * @return array|false Returned array matches parameters for `imagecopyresampled()`. False on failure.
    531537 */
     
    671677 * @since 2.5.0
    672678 *
    673  * @param string $file   File path.
    674  * @param int    $width  Image width.
    675  * @param int    $height Image height.
    676  * @param bool   $crop   Optional. Whether to crop image to specified width and height or resize.
    677  *                       Default false.
     679 * @param string     $file   File path.
     680 * @param int        $width  Image width.
     681 * @param int        $height Image height.
     682 * @param bool|array $crop   {
     683 *     Optional. Image cropping behavior. If false, the image will be scaled (default),
     684 *     If true, image will be cropped to the specified dimensions using center positions.
     685 *     If an array, the image will be cropped using the array to specify the crop location:
     686 *
     687 *     @type string $0 The x crop position. Accepts 'left' 'center', or 'right'.
     688 *     @type string $1 The y crop position. Accepts 'top', 'center', or 'bottom'.
     689 * }
    678690 * @return array|false Metadata array on success. False if no image was created.
    679691 */
Note: See TracChangeset for help on using the changeset viewer.