Make WordPress Core

Ticket #32363: 32363.3.patch

File 32363.3.patch, 1.5 KB (added by eclev91, 11 years ago)

Syntax error resolved, tested with use case

  • src/wp-includes/media.php

     
    688688 * @return bool|array Returns an array (url, width, height), or false, if no image is available.
    689689 */
    690690function wp_get_attachment_image_src( $attachment_id, $size = 'thumbnail', $icon = false ) {
    691 
     691        $image = false;
    692692        // get a thumbnail or intermediate image if there is one
    693         if ( $image = image_downsize($attachment_id, $size) )
    694                 return $image;
     693        $image = image_downsize($attachment_id, $size);
     694        if(!$image) {
     695                $src = false;
    695696
    696         $src = false;
     697                if ( $icon && $src = wp_mime_type_icon($attachment_id) ) {
     698                        /** This filter is documented in wp-includes/post.php */
     699                        $icon_dir = apply_filters( 'icon_dir', ABSPATH . WPINC . '/images/media' );
    697700
    698         if ( $icon && $src = wp_mime_type_icon($attachment_id) ) {
    699                 /** This filter is documented in wp-includes/post.php */
    700                 $icon_dir = apply_filters( 'icon_dir', ABSPATH . WPINC . '/images/media' );
    701 
    702                 $src_file = $icon_dir . '/' . wp_basename($src);
    703                 @list($width, $height) = getimagesize($src_file);
     701                        $src_file = $icon_dir . '/' . wp_basename($src);
     702                        @list($width, $height) = getimagesize($src_file);
     703                }
     704                if ( $src && $width && $height )
     705                        $image = array( $src, $width, $height );
    704706        }
    705         if ( $src && $width && $height )
    706                 return array( $src, $width, $height );
    707         return false;
     707        return apply_filters('wp_get_attachment_image_src_fallback', $image, $attachment_id, $size, $icon);
    708708}
    709709
    710710/**