diff --git a/src/wp-includes/media.php b/src/wp-includes/media.php
index e0ed8f4..043ec38 100644
a
|
b
|
function image_make_intermediate_size( $file, $width, $height, $crop = false ) { |
600 | 600 | * @param int $post_id Attachment ID. |
601 | 601 | * @param array|string $size Optional. Registered image size to retrieve or flat array of height |
602 | 602 | * and width dimensions. Default 'thumbnail'. |
603 | | * @return false|array False on failure or array of file path, width, and height on success. |
| 603 | * @return false|array $data { |
| 604 | * Array of file relative path, width, and height on success. |
| 605 | * Additionally includes absolute path and URL if registered size is passed to $size parameter. |
| 606 | * False on failure. |
| 607 | * |
| 608 | * @type string $file Image's path relative to uploads directory |
| 609 | * @type int $width Width of image |
| 610 | * @type int $height Height of image |
| 611 | * @type string $path Optional. Image's absolute filesystem path. |
| 612 | * Only returned if registered size is passed to $size parameter. |
| 613 | * @type string $url Optional. Image's URL. |
| 614 | * Only returned if registered size is passed to $size parameter. |
| 615 | * } |
604 | 616 | */ |
605 | 617 | function image_get_intermediate_size( $post_id, $size = 'thumbnail' ) { |
606 | 618 | if ( !is_array( $imagedata = wp_get_attachment_metadata( $post_id ) ) ) |
… |
… |
function image_get_intermediate_size( $post_id, $size = 'thumbnail' ) { |
613 | 625 | foreach ( $imagedata['sizes'] as $_size => $data ) { |
614 | 626 | // If there's an exact match to an existing image size, short circuit. |
615 | 627 | if ( $data['width'] == $size[0] && $data['height'] == $size[1] ) { |
616 | | $file = $data['file']; |
617 | | list($width, $height) = image_constrain_size_for_editor( $data['width'], $data['height'], $size ); |
618 | | return compact( 'file', 'width', 'height' ); |
| 628 | list( $data['width'], $data['height'] ) = image_constrain_size_for_editor( $data['width'], $data['height'], $size ); |
| 629 | |
| 630 | /** This filter is documented in wp-includes/media.php */ |
| 631 | return apply_filters( 'image_get_intermediate_size', $data, $post_id, $size ); |
619 | 632 | } |
620 | 633 | // If it's not an exact match but it's at least the dimensions requested. |
621 | 634 | if ( $data['width'] >= $size[0] && $data['height'] >= $size[1] ) { |
… |
… |
function image_get_intermediate_size( $post_id, $size = 'thumbnail' ) { |
641 | 654 | continue; |
642 | 655 | } |
643 | 656 | // If we're still here, then we're going to use this size |
644 | | $file = $data['file']; |
645 | | list( $width, $height ) = image_constrain_size_for_editor( $data['width'], $data['height'], $size ); |
646 | | return compact( 'file', 'width', 'height' ); |
| 657 | list( $data['width'], $data['height'] ) = image_constrain_size_for_editor( $data['width'], $data['height'], $size ); |
| 658 | |
| 659 | /** This filter is documented in wp-includes/media.php */ |
| 660 | return apply_filters( 'image_get_intermediate_size', $data, $post_id, $size ); |
647 | 661 | } |
648 | 662 | } |
649 | 663 | } |
… |
… |
function image_get_intermediate_size( $post_id, $size = 'thumbnail' ) { |
658 | 672 | $data['path'] = path_join( dirname($imagedata['file']), $data['file'] ); |
659 | 673 | $data['url'] = path_join( dirname($file_url), $data['file'] ); |
660 | 674 | } |
661 | | return $data; |
| 675 | |
| 676 | /** |
| 677 | * Filter the output of image_get_intermediate_size() |
| 678 | * |
| 679 | * @since 4.4.0 |
| 680 | * |
| 681 | * @see image_get_intermediate_size() |
| 682 | * |
| 683 | * @param array $data Array of file relative path, width, and height on success. |
| 684 | * May also include file absolute path and URL. See image_get_intermediate_size() for details. |
| 685 | * @param int $post_id The post_id of the image attachment |
| 686 | * @param string|array $size Registered image size or flat array of height and width dimensions initially requested. |
| 687 | */ |
| 688 | return apply_filters( 'image_get_intermediate_size', $data, $post_id, $size ); |
662 | 689 | } |
663 | 690 | |
664 | 691 | /** |