WordPress.org

Make WordPress Core

Ticket #15614: 15614.diff

File 15614.diff, 1.1 KB (added by mtdewvirus, 4 years ago)
  • media.php

     
    599599 * @return bool|array Returns an array (url, width, height), or false, if no image is available. 
    600600 */ 
    601601function wp_get_attachment_image_src($attachment_id, $size='thumbnail', $icon = false) { 
     602        if ( !wp_attachment_is_image( $attachment_id ) ) 
     603                return false; 
    602604 
    603605        // get a thumbnail or intermediate image if there is one 
    604606        if ( $image = image_downsize($attachment_id, $size) ) 
     
    635637 * @return string HTML img element or empty string on failure. 
    636638 */ 
    637639function wp_get_attachment_image($attachment_id, $size = 'thumbnail', $icon = false, $attr = '') { 
     640        $html = ''; 
    638641 
    639         $html = ''; 
     642        if ( !wp_attachment_is_image( $attachment_id ) ) 
     643                return $html; 
     644 
    640645        $image = wp_get_attachment_image_src($attachment_id, $size, $icon); 
    641646        if ( $image ) { 
    642647                list($src, $width, $height) = $image; 
     
    13961401        require_once( ABSPATH . WPINC . '/class-oembed.php' ); 
    13971402        $oembed = _wp_oembed_get_object(); 
    13981403        $oembed->providers[$format] = array( $provider, $regex ); 
    1399 } 
    1400  No newline at end of file 
     1404}