Make WordPress Core

Ticket #11887: bmb_0008_t11887.patch

File bmb_0008_t11887.patch, 2.2 KB (added by bumbu, 13 years ago)

this is full patch

  • wp-includes/media.php

     
    137137        $meta = wp_get_attachment_metadata($id);
    138138        $width = $height = 0;
    139139        $is_intermediate = false;
     140        $img_url_basename = substr(basename(str_replace('\\','\\a',str_replace('/','/a',$img_url))),1);
    140141
    141142        // plugins can use this to provide resize services
    142143        if ( $out = apply_filters('image_downsize', false, $id, $size) )
     
    144145
    145146        // try for a new style intermediate size
    146147        if ( $intermediate = image_get_intermediate_size($id, $size) ) {
    147                 $img_url = str_replace(basename($img_url), $intermediate['file'], $img_url);
     148                $img_url = str_replace($img_url_basename, $intermediate['file'], $img_url);
    148149                $width = $intermediate['width'];
    149150                $height = $intermediate['height'];
    150151                $is_intermediate = true;
     
    152153        elseif ( $size == 'thumbnail' ) {
    153154                // fall back to the old thumbnail
    154155                if ( ($thumb_file = wp_get_attachment_thumb_file($id)) && $info = getimagesize($thumb_file) ) {
    155                         $img_url = str_replace(basename($img_url), basename($thumb_file), $img_url);
     156                        $thumb_file_basename = substr(basename(str_replace('\\','\\a',str_replace('/','/a',$thumb_file))),1);
     157                        $img_url = str_replace($img_url_basename, $thumb_file_basename, $img_url);
    156158                        $width = $info[0];
    157159                        $height = $info[1];
    158160                        $is_intermediate = true;
     
    412414        $info = pathinfo($file);
    413415        $dir = $info['dirname'];
    414416        $ext = $info['extension'];
    415         $name = basename($file, ".{$ext}");
     417        $name = substr(basename(str_replace('\\','\\a',str_replace('/','/a',$file)), ".{$ext}"),1);
    416418        if ( !is_null($dest_path) and $_dest_path = realpath($dest_path) )
    417419                $dir = $_dest_path;
    418420        $destfilename = "{$dir}/{$name}-{$suffix}.{$ext}";
     
    461463                if ( !is_wp_error($resized_file) && $resized_file && $info = getimagesize($resized_file) ) {
    462464                        $resized_file = apply_filters('image_make_intermediate_size', $resized_file);
    463465                        return array(
    464                                 'file' => basename( $resized_file ),
     466                                'file' => substr(basename(str_replace('\\','\\a',str_replace('/','/a',$resized_file))),1),
    465467                                'width' => $info[0],
    466468                                'height' => $info[1],
    467469                        );