diff --git src/wp-includes/media.php src/wp-includes/media.php
index f6c5f0f..8a95ea0 100644
|
|
|
function wp_prepare_attachment_for_js( $attachment ) { |
| 3140 | 3140 | // If the filter does not return something, then image_downsize() is just an expensive |
| 3141 | 3141 | // way to check the image metadata, which we do second. |
| 3142 | 3142 | foreach ( $possible_sizes as $size => $label ) { |
| 3143 | | |
| 3144 | 3143 | /** This filter is documented in wp-includes/media.php */ |
| 3145 | 3144 | if ( $downsize = apply_filters( 'image_downsize', false, $attachment->ID, $size ) ) { |
| 3146 | 3145 | if ( ! $downsize[3] ) |
| … |
… |
function wp_prepare_attachment_for_js( $attachment ) { |
| 3151 | 3150 | 'url' => $downsize[0], |
| 3152 | 3151 | 'orientation' => $downsize[2] > $downsize[1] ? 'portrait' : 'landscape', |
| 3153 | 3152 | ); |
| 3154 | | } elseif ( isset( $meta['sizes'][ $size ] ) ) { |
| | 3153 | } |
| | 3154 | } |
| | 3155 | |
| | 3156 | // If the image_downsize filter didn't return anything, we use the metadata. |
| | 3157 | if ( empty( $sizes ) && isset( $meta['sizes'] ) ) { |
| | 3158 | foreach( $meta['sizes'] as $size => $size_meta ) { |
| 3155 | 3159 | if ( ! isset( $base_url ) ) |
| 3156 | 3160 | $base_url = str_replace( wp_basename( $attachment_url ), '', $attachment_url ); |
| 3157 | 3161 | |
| 3158 | | // Nothing from the filter, so consult image metadata if we have it. |
| 3159 | | $size_meta = $meta['sizes'][ $size ]; |
| 3160 | | |
| 3161 | 3162 | // We have the actual image size, but might need to further constrain it if content_width is narrower. |
| 3162 | 3163 | // Thumbnail, medium, and full sizes are also checked against the site's height/width options. |
| 3163 | 3164 | list( $width, $height ) = image_constrain_size_for_editor( $size_meta['width'], $size_meta['height'], $size, 'edit' ); |