WordPress.org

Make WordPress Core

Ticket #16226: 16226.2.diff

File 16226.2.diff, 1.5 KB (added by dd32, 7 years ago)
  • wp-includes/media.php

     
    169169                // we have the actual image size, but might need to further constrain it if content_width is narrower
    170170                list( $width, $height ) = image_constrain_size_for_editor( $width, $height, $size );
    171171
     172                $img_url = dirname($img_url) . '/' . urlencode(basename($img_url));
     173
    172174                return array( $img_url, $width, $height, $is_intermediate );
    173175        }
    174176        return false;
     
    565567        $data = $imagedata['sizes'][$size];
    566568        // include the full filesystem path of the intermediate file
    567569        if ( empty($data['path']) && !empty($data['file']) ) {
    568                 $file_url = wp_get_attachment_url($post_id);
     570                $file_url = wp_get_attachment_url($post_id); // What's this here for? and why is the return of this block of code completely different to the 2 above documented returns?
    569571                $data['path'] = path_join( dirname($imagedata['file']), $data['file'] );
    570572                $data['url'] = path_join( dirname($file_url), $data['file'] );
    571573        }
  • wp-includes/post.php

     
    38323832
    38333833        $url = apply_filters( 'wp_get_attachment_url', $url, $post->ID );
    38343834
     3835        if ( $url )
     3836                $url = dirname($url) . '/' . urlencode(basename($url)); // encode the filename
     3837
    38353838        if ( 'attachment' != $post->post_type || empty( $url ) )
    38363839                return false;
    38373840