Make WordPress Core

Ticket #48518: 48518.diff

File 48518.diff, 926 bytes (added by azaozz, 6 years ago)
  • src/wp-admin/includes/image.php

     
    9090                return $registered_sizes;
    9191        }
    9292
    93         $full_width     = (int) $image_meta['width'];
    94         $full_height    = (int) $image_meta['height'];
     93        // Use the originally uploaded image dimensions as full_width and full_height.
     94        if ( ! empty( $image_meta['original_image'] ) ) {
     95                $image_file = wp_get_original_image_path( $attachment_id );
     96                $imagesize  = @getimagesize( $image_file );
     97        }
     98
     99        if ( ! empty( $imagesize ) ) {
     100                $full_width  = $imagesize[0];
     101                $full_height = $imagesize[1];
     102        } else {
     103                $full_width  = (int) $image_meta['width'];
     104                $full_height = (int) $image_meta['height'];
     105        }
     106
    95107        $possible_sizes = array();
    96108
    97109        // Skip registered sizes that are too large for the uploaded image.