Ticket #22598: 22598.diff
| File 22598.diff, 1.6 KB (added by , 13 years ago) |
|---|
-
wp-includes/media.php
1331 1331 1332 1332 if ( $meta && 'image' === $type ) { 1333 1333 $sizes = array(); 1334 $base_url = str_replace( wp_basename( $attachment_url ), '', $attachment_url ); 1334 $possible_sizes = apply_filters( 'image_size_names_choose', array( 1335 'thumbnail' => __('Thumbnail'), 1336 'medium' => __('Medium'), 1337 'large' => __('Large'), 1338 'full' => __('Full Size'), 1339 ) ); 1335 1340 1336 if ( isset( $meta['sizes'] ) ) { 1337 foreach ( $meta['sizes'] as $slug => $size ) { 1338 $sizes[ $slug ] = array( 1339 'height' => $size['height'], 1340 'width' => $size['width'], 1341 'url' => $base_url . $size['file'], 1342 'orientation' => $size['height'] > $size['width'] ? 'portrait' : 'landscape', 1341 foreach ( $possible_sizes as $size => $label ) { 1342 $downsize = image_downsize( $attachment->ID, $size ); 1343 if ( 'full' == $size || $downsize[3] ) { 1344 $sizes[ $size ] = array( 1345 'height' => $downsize[2], 1346 'width' => $downsize[1], 1347 'url' => $downsize[0], 1348 'orientation' => $downsize[2] > $downsize[1] ? 'portrait' : 'landscape', 1343 1349 ); 1344 1350 } 1345 1351 } 1346 1352 1347 $sizes['full'] = array(1348 'height' => $meta['height'],1349 'width' => $meta['width'],1350 'url' => $attachment_url,1351 'orientation' => $meta['height'] > $meta['width'] ? 'portrait' : 'landscape',1352 );1353 1354 1353 $response = array_merge( $response, array( 'sizes' => $sizes ), $sizes['full'] ); 1355 1354 } 1356 1355