Ticket #20205: media.php.2.patch
File media.php.2.patch, 1.6 KB (added by , 12 years ago) |
---|
-
wp-includes/media.php
491 491 * 492 492 * A mime icon for files, thumbnail or intermediate size for images. 493 493 * 494 * @uses apply_filters() Calls 'wp_get_attachment_image_src' hook on image array 494 495 * @since 2.5.0 495 496 * 496 497 * @param int $attachment_id Image attachment ID. … … 501 502 function wp_get_attachment_image_src($attachment_id, $size='thumbnail', $icon = false) { 502 503 503 504 // get a thumbnail or intermediate image if there is one 504 if ( $image = image_downsize($attachment_id, $size) )505 return $image;505 if (false === ( $image = image_downsize($attachment_id, $size) ) ) { 506 $src = false; 506 507 507 $src = false; 508 509 if ( $icon && $src = wp_mime_type_icon($attachment_id) ) { 510 $icon_dir = apply_filters( 'icon_dir', ABSPATH . WPINC . '/images/crystal' ); 511 $src_file = $icon_dir . '/' . wp_basename($src); 512 @list($width, $height) = getimagesize($src_file); 508 if ( $icon && $src = wp_mime_type_icon($attachment_id) ) { 509 $icon_dir = apply_filters( 'icon_dir', ABSPATH . WPINC . '/images/crystal' ); 510 $src_file = $icon_dir . '/' . wp_basename($src); 511 @list($width, $height) = getimagesize($src_file); 512 } 513 if ( $src && $width && $height ) 514 $image = array( $src, $width, $height ); 513 515 } 514 if ( $src && $width && $height ) 515 return array( $src, $width, $height ); 516 $image = apply_filters( 'wp_get_attachment_image_src', $image, $attachment_id, $size, $icon ); 517 if (!empty($image)) 518 return $image; 516 519 return false; 517 520 } 518 521