- Timestamp:
- 07/21/2020 11:12:22 PM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/widgets/class-wp-widget-media-image.php
r47055 r48557 185 185 186 186 $attachment = null; 187 187 188 if ( $this->is_attachment_with_mime_type( $instance['attachment_id'], $this->widget_options['mime_type'] ) ) { 188 189 $attachment = get_post( $instance['attachment_id'] ); 189 190 } 191 190 192 if ( $attachment ) { 191 193 $caption = ''; … … 209 211 210 212 $size = $instance['size']; 213 211 214 if ( 'custom' === $size || ! in_array( $size, array_merge( get_intermediate_image_sizes(), array( 'full' ) ), true ) ) { 212 $size = array( $instance['width'], $instance['height'] ); 213 } 215 $size = array( $instance['width'], $instance['height'] ); 216 $width = $instance['width']; 217 } else { 218 $caption_size = _wp_get_image_size_from_meta( $instance['size'], wp_get_attachment_metadata( $attachment->ID ) ); 219 $width = empty( $caption_size[0] ) ? 0 : $caption_size[0]; 220 } 221 214 222 $image_attributes['class'] .= sprintf( ' attachment-%1$s size-%1$s', is_array( $size ) ? join( 'x', $size ) : $size ); 215 223 216 224 $image = wp_get_attachment_image( $attachment->ID, $size, false, $image_attributes ); 217 218 $caption_size = _wp_get_image_size_from_meta( $instance['size'], wp_get_attachment_metadata( $attachment->ID ) );219 $width = empty( $caption_size[0] ) ? 0 : $caption_size[0];220 225 221 226 } else {
Note: See TracChangeset
for help on using the changeset viewer.