Ticket #14148: 14148.diff
File 14148.diff, 2.8 KB (added by , 14 years ago) |
---|
-
media.php
145 145 146 146 // try for a new style intermediate size 147 147 if ( $intermediate = image_get_intermediate_size($id, $size) ) { 148 $img_url = str_replace($img_url_basename, $intermediate['file'], $img_url);148 $img_url = str_replace($img_url_basename, urlencode( $intermediate['file'] ), $img_url); 149 149 $width = $intermediate['width']; 150 150 $height = $intermediate['height']; 151 151 $is_intermediate = true; … … 153 153 elseif ( $size == 'thumbnail' ) { 154 154 // fall back to the old thumbnail 155 155 if ( ($thumb_file = wp_get_attachment_thumb_file($id)) && $info = getimagesize($thumb_file) ) { 156 $img_url = str_replace($img_url_basename, wp_basename($thumb_file), $img_url);156 $img_url = str_replace($img_url_basename, urlencode( wp_basename($thumb_file) ), $img_url); 157 157 $width = $info[0]; 158 158 $height = $info[1]; 159 159 $is_intermediate = true; -
post.php
3809 3809 return false; 3810 3810 3811 3811 $url = ''; 3812 if ( $file = get_post_meta( $post->ID, '_wp_attached_file', true) ) { //Get attached file 3813 if ( ($uploads = wp_upload_dir()) && false === $uploads['error'] ) { //Get upload directory 3814 if ( 0 === strpos($file, $uploads['basedir']) ) //Check that the upload base exists in the file location 3815 $url = str_replace($uploads['basedir'], $uploads['baseurl'], $file); //replace file location with url location 3816 elseif ( false !== strpos($file, 'wp-content/uploads') ) 3817 $url = $uploads['baseurl'] . substr( $file, strpos($file, 'wp-content/uploads') + 18 ); 3818 else 3819 $url = $uploads['baseurl'] . "/$file"; //Its a newly uploaded file, therefor $file is relative to the basedir. 3812 if ( $file = get_post_meta( $post->ID, '_wp_attached_file', true ) ) { // Get attached file 3813 if ( ($uploads = wp_upload_dir()) && false === $uploads['error'] ) { // Get upload directory 3814 if ( 0 === strpos( $file, $uploads['basedir'] ) ) // Check that the upload base exists in the file location 3815 $file = substr( $file, strlen( $uploads['basedir'] ) + 1 ); 3816 elseif ( false !== strpos( $file, 'wp-content/uploads' ) ) 3817 $file = substr( $file, strpos($file, 'wp-content/uploads' ) + 19 ); 3818 $url = $uploads['baseurl'] . '/' . implode( '/', urlencode_deep( explode( '/', $file ) ) ); 3820 3819 } 3821 3820 } 3822 3821 3823 if ( empty($url) ) // If any of the above options failed, Fallback on the GUID as used pre-2.7, not recomended to rely upon this.3822 if ( empty($url) ) // If any of the above options failed, Fallback on the GUID as used pre-2.7, not recomended to rely upon this. 3824 3823 $url = get_the_guid( $post->ID ); 3825 3824 3826 3825 $url = apply_filters( 'wp_get_attachment_url', $url, $post->ID );