WordPress.org

Make WordPress Core

Ticket #7622: 7622.patch

File 7622.patch, 1.6 KB (added by DD32, 6 years ago)
  • wp-admin/includes/image.php

     
    8888 
    8989        $metadata = array(); 
    9090        if ( preg_match('!^image/!', get_post_mime_type( $attachment )) && file_is_displayable_image($file) ) { 
    91                 $imagesize = getimagesize( $file ); 
     91                $full_path_file = $file; 
     92                $imagesize = getimagesize( $full_path_file ); 
    9293                $metadata['width'] = $imagesize[0]; 
    9394                $metadata['height'] = $imagesize[1]; 
    9495                list($uwidth, $uheight) = wp_shrink_dimensions($metadata['width'], $metadata['height']); 
    9596                $metadata['hwstring_small'] = "height='$uheight' width='$uwidth'"; 
     97                 
    9698                // Make the file path relative to the upload dir 
    9799                if ( ($uploads = wp_upload_dir()) && false === $uploads['error'] ) { // Get upload directory 
    98100                        if ( 0 === strpos($file, $uploads['basedir']) ) {// Check that the upload base exists in the file path 
     
    107109                $sizes = apply_filters('intermediate_image_sizes', $sizes); 
    108110 
    109111                foreach ($sizes as $size) { 
    110                         $resized = image_make_intermediate_size( $file, get_option("{$size}_size_w"), get_option("{$size}_size_h"), get_option("{$size}_crop") ); 
     112                        $resized = image_make_intermediate_size( $full_path_file, get_option("{$size}_size_w"), get_option("{$size}_size_h"), get_option("{$size}_crop") ); 
    111113                        if ( $resized ) 
    112114                                $metadata['sizes'][$size] = $resized; 
    113115                } 
    114116 
    115117                // fetch additional metadata from exif/iptc 
    116                 $image_meta = wp_read_image_metadata( $file ); 
     118                $image_meta = wp_read_image_metadata( $full_path_file ); 
    117119                if ($image_meta) 
    118120                        $metadata['image_meta'] = $image_meta; 
    119121