diff --git src/wp-includes/media.php src/wp-includes/media.php
index 6b0187a..8d3f091 100644
|
|
|
function image_hwstring( $width, $height ) { |
| 155 | 155 | * |
| 156 | 156 | * @since 2.5.0 |
| 157 | 157 | * |
| 158 | | * @param int $id Attachment ID for image. |
| 159 | | * @param array|string $size Optional. Image size to scale to. Accepts any valid image size, |
| 160 | | * or an array of width and height values in pixels (in that order). |
| 161 | | * Default 'medium'. |
| | 158 | * @param int $id Attachment ID for image. |
| | 159 | * @param array|string $size Optional. Image size to scale to. Accepts any valid image size, |
| | 160 | * or an array of width and height values in pixels (in that order). |
| | 161 | * Default 'medium'. |
| | 162 | * @param bool $constrain Optional. Whether to constrain the image to content width or not. |
| | 163 | * Default true. |
| 162 | 164 | * @return false|array Array containing the image URL, width, height, and boolean for whether |
| 163 | 165 | * the image is an intermediate size. False on failure. |
| 164 | 166 | */ |
| 165 | | function image_downsize( $id, $size = 'medium' ) { |
| | 167 | function image_downsize( $id, $size = 'medium', $constrain = true ) { |
| 166 | 168 | |
| 167 | 169 | if ( !wp_attachment_is_image($id) ) |
| 168 | 170 | return false; |
| … |
… |
function image_downsize( $id, $size = 'medium' ) { |
| 212 | 214 | $height = $meta['height']; |
| 213 | 215 | } |
| 214 | 216 | |
| 215 | | if ( $img_url) { |
| 216 | | // we have the actual image size, but might need to further constrain it if content_width is narrower |
| 217 | | list( $width, $height ) = image_constrain_size_for_editor( $width, $height, $size ); |
| | 217 | if ( $img_url ) { |
| | 218 | |
| | 219 | if ( $constrain ) { |
| | 220 | // We have the actual image size, but might need to further constrain it if content_width is narrower. |
| | 221 | list( $width, $height ) = image_constrain_size_for_editor( $width, $height, $size ); |
| | 222 | } |
| 218 | 223 | |
| 219 | 224 | return array( $img_url, $width, $height, $is_intermediate ); |
| 220 | 225 | } |
| … |
… |
function get_intermediate_image_sizes() { |
| 749 | 754 | * @return false|array Returns an array (url, width, height, is_intermediate), or false, if no image is available. |
| 750 | 755 | */ |
| 751 | 756 | function wp_get_attachment_image_src( $attachment_id, $size = 'thumbnail', $icon = false ) { |
| 752 | | // get a thumbnail or intermediate image if there is one |
| 753 | | $image = image_downsize( $attachment_id, $size ); |
| | 757 | // Get a thumbnail or intermediate image if there is one. |
| | 758 | $image = image_downsize( $attachment_id, $size, false ); |
| | 759 | |
| 754 | 760 | if ( ! $image ) { |
| 755 | 761 | $src = false; |
| 756 | 762 | |