Changeset 35289
- Timestamp:
- 10/20/2015 07:23:18 AM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/media.php
r35250 r35289 608 608 * of width and height values in pixels (in that order). 609 609 * Default 'thumbnail'. 610 * @return false|array False on failure or array of file path, width, and height on success. 610 * @return false|array $data { 611 * Array of file relative path, width, and height on success. Additionally includes absolute 612 * path and URL if registered size is passed to $size parameter. False on failure. 613 * 614 * @type string $file Image's path relative to uploads directory 615 * @type int $width Width of image 616 * @type int $height Height of image 617 * @type string $path Optional. Image's absolute filesystem path. Only returned if registered 618 * size is passed to `$size` parameter. 619 * @type string $url Optional. Image's URL. Only returned if registered size is passed to `$size` 620 * parameter. 621 * } 611 622 */ 612 623 function image_get_intermediate_size( $post_id, $size = 'thumbnail' ) { … … 621 632 // If there's an exact match to an existing image size, short circuit. 622 633 if ( $data['width'] == $size[0] && $data['height'] == $size[1] ) { 623 $file = $data['file']; 624 list($width, $height) = image_constrain_size_for_editor( $data['width'], $data['height'], $size ); 625 return compact( 'file', 'width', 'height' ); 634 list( $data['width'], $data['height'] ) = image_constrain_size_for_editor( $data['width'], $data['height'], $size ); 635 636 /** This filter is documented in wp-includes/media.php */ 637 return apply_filters( 'image_get_intermediate_size', $data, $post_id, $size ); 626 638 } 627 639 // If it's not an exact match but it's at least the dimensions requested. … … 648 660 continue; 649 661 } 650 // If we're still here, then we're going to use this size 651 $file = $data['file']; 652 list( $width, $height ) = image_constrain_size_for_editor( $data['width'], $data['height'], $size ); 653 return compact( 'file', 'width', 'height' ); 662 // If we're still here, then we're going to use this size. 663 list( $data['width'], $data['height'] ) = image_constrain_size_for_editor( $data['width'], $data['height'], $size ); 664 665 /** This filter is documented in wp-includes/media.php */ 666 return apply_filters( 'image_get_intermediate_size', $data, $post_id, $size ); 654 667 } 655 668 } … … 666 679 $data['url'] = path_join( dirname($file_url), $data['file'] ); 667 680 } 668 return $data; 681 682 /** 683 * Filter the output of image_get_intermediate_size() 684 * 685 * @since 4.4.0 686 * 687 * @see image_get_intermediate_size() 688 * 689 * @param array $data Array of file relative path, width, and height on success. May also include 690 * file absolute path and URL. 691 * @param int $post_id The post_id of the image attachment 692 * @param string|array $size Registered image size or flat array of initially-requested height and width 693 * dimensions (in that order). 694 */ 695 return apply_filters( 'image_get_intermediate_size', $data, $post_id, $size ); 669 696 } 670 697
Note: See TracChangeset
for help on using the changeset viewer.