Make WordPress Core


Ignore:
Timestamp:
11/08/2019 10:55:34 PM (5 years ago)
Author:
azaozz
Message:

Upload: When an image was scaled because it is larger than the big image threshold, use the originally uploaded image's dimensions in wp_get_missing_image_subsizes(). Fixes an edge case/inconsistent behaviour when a registered image sub-size is also larger than the big image threshold.

Props desrosj, azaozz.
Merges [46677] to the 5.3 branch.
Fixes #48518.

Location:
branches/5.3
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/5.3

  • branches/5.3/src/wp-admin/includes/image.php

    r46659 r46680  
    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
Note: See TracChangeset for help on using the changeset viewer.