Skip to content

Commit

Permalink
Docs: Improve and update the description of multi_resize() to expla…
Browse files Browse the repository at this point in the history
…in changes and expected use.

See #40439.

git-svn-id: https://develop.svn.wordpress.org/trunk@45892 602fd350-edb4-49c9-b593-d223f7449a82
  • Loading branch information
azaozz committed Aug 25, 2019
1 parent 252e14a commit 152083b
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 5 deletions.
14 changes: 11 additions & 3 deletions src/wp-includes/class-wp-image-editor-gd.php
Expand Up @@ -197,16 +197,24 @@ protected function _resize( $max_w, $max_h, $crop = false ) {
}

/**
* Resize multiple images from a single source.
* Create multiple smaller images from a single source.
*
* Attempts to create all sub-sizes and returns the meta data at the end. This
* may result in the server running out of resources. When it fails there may be few
* "orphaned" images left over as the meta data is never returned and saved.
*
* As of 5.3.0 the preferred way to do this is with `make_subsize()`. It creates
* the new images one at a time and allows for the meta data to be saved after
* each new image is created.
*
* @since 3.5.0
*
* @param array $sizes {
* An array of image size arrays. Default sizes are 'small', 'medium', 'medium_large', 'large'.
* An array of image size data arrays.
*
* Either a height or width must be provided.
* If one of the two is set to null, the resize will
* maintain aspect ratio according to the provided dimension.
* maintain aspect ratio according to the source image.
*
* @type array $size {
* Array of height, width values, and whether to crop.
Expand Down
12 changes: 10 additions & 2 deletions src/wp-includes/class-wp-image-editor-imagick.php
Expand Up @@ -410,12 +410,20 @@ protected function thumbnail_image( $dst_w, $dst_h, $filter_name = 'FILTER_TRIAN
}

/**
* Resize multiple images from a single source.
* Create multiple smaller images from a single source.
*
* Attempts to create all sub-sizes and returns the meta data at the end. This
* may result in the server running out of resources. When it fails there may be few
* "orphaned" images left over as the meta data is never returned and saved.
*
* As of 5.3.0 the preferred way to do this is with `make_subsize()`. It creates
* the new images one at a time and allows for the meta data to be saved after
* each new image is created.
*
* @since 3.5.0
*
* @param array $sizes {
* An array of image size arrays. Default sizes are 'thumbnail', 'medium', 'medium_large', 'large'.
* An array of image size data arrays.
*
* Either a height or width must be provided.
* If one of the two is set to null, the resize will
Expand Down

0 comments on commit 152083b

Please sign in to comment.