Changeset 48547
- Timestamp:
- 07/21/2020 04:52:48 PM (4 years ago)
- Location:
- trunk/src/wp-includes
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/media.php
r48496 r48547 1508 1508 * @since 5.5.0 1509 1509 * 1510 * @param string $image_location The full path or URI to the image file. 1511 * @param array $image_meta The attachment meta data as returned by 'wp_get_attachment_metadata()'. 1510 * @param string $image_location The full path or URI to the image file. 1511 * @param array $image_meta The attachment meta data as returned by 'wp_get_attachment_metadata()'. 1512 * @param int $attachment_id Optional. The image attachment ID. Default 0. 1512 1513 * @return bool Whether the image meta is for this image file. 1513 1514 */ 1514 function wp_image_file_matches_image_meta( $image_location, $image_meta ) {1515 function wp_image_file_matches_image_meta( $image_location, $image_meta, $attachment_id = 0 ) { 1515 1516 $match = false; 1516 1517 … … 1560 1561 * matches the end of the URI or path to the image file. 1561 1562 * @param string $image_location Full path or URI to the tested image file. 1562 * @param array $image_meta The image meta data being tested. 1563 */ 1564 return apply_filters( 'wp_image_file_matches_image_meta', $match, $image_location, $image_meta ); 1563 * @param array $image_meta The image meta data as returned by 'wp_get_attachment_metadata()'. 1564 * @param int $attachment_id The image attachment ID or 0 if not supplied. 1565 */ 1566 return apply_filters( 'wp_image_file_matches_image_meta', $match, $image_location, $image_meta, $attachment_id ); 1565 1567 } 1566 1568 … … 1570 1572 * @since 5.5.0 1571 1573 * 1572 * @param string $image_src The image source file. 1573 * @param array $image_meta The image meta data as returned by 'wp_get_attachment_metadata()'. 1574 * @param string $image_src The image source file. 1575 * @param array $image_meta The image meta data as returned by 'wp_get_attachment_metadata()'. 1576 * @param int $attachment_id Optional. The image attachment ID. Default 0. 1574 1577 * @return array|false Array with first element being the width and second element being the height, 1575 1578 * or false if dimensions cannot be determined. 1576 1579 */ 1577 function wp_image_src_get_dimensions( $image_src, $image_meta ) {1578 if ( ! wp_image_file_matches_image_meta( $image_src, $image_meta ) ) {1580 function wp_image_src_get_dimensions( $image_src, $image_meta, $attachment_id = 0 ) { 1581 if ( ! wp_image_file_matches_image_meta( $image_src, $image_meta, $attachment_id ) ) { 1579 1582 return false; 1580 1583 } … … 1644 1647 $size_array = array( $width, $height ); 1645 1648 } else { 1646 $size_array = wp_image_src_get_dimensions( $image_src, $image_meta );1649 $size_array = wp_image_src_get_dimensions( $image_src, $image_meta, $attachment_id ); 1647 1650 if ( ! $size_array ) { 1648 1651 return $image; … … 1864 1867 if ( true === $add ) { 1865 1868 $image_meta = wp_get_attachment_metadata( $attachment_id ); 1866 $size_array = wp_image_src_get_dimensions( $image_src, $image_meta );1869 $size_array = wp_image_src_get_dimensions( $image_src, $image_meta, $attachment_id ); 1867 1870 1868 1871 if ( $size_array ) { -
trunk/src/wp-includes/rest-api/endpoints/class-wp-rest-attachments-controller.php
r48525 r48547 425 425 ! $image_meta || 426 426 ! $image_file || 427 ! wp_image_file_matches_image_meta( $request['src'], $image_meta )427 ! wp_image_file_matches_image_meta( $request['src'], $image_meta, $attachment_id ) 428 428 ) { 429 429 return new WP_Error(
Note: See TracChangeset
for help on using the changeset viewer.