Make WordPress Core


Ignore:
Timestamp:
11/07/2019 06:49:17 PM (7 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.
Fixes #48518 for trunk.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/includes/image.php

    r46658 r46677  
    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.