Make WordPress Core


Ignore:
Timestamp:
06/25/2024 03:30:57 PM (9 months ago)
Author:
jorbin
Message:

Media: unfix admin image cropping calculations.

[58456] introduced some failures to the automated test system that indicate this fix is incomplete.

See #32282.
Props hellofromtonya, audrasjb, andrewserong, kevin940726, oglekler.

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk

    • Property svn:mergeinfo changed
      /trunk (added)merged: 58570
  • trunk/src/wp-admin/includes/image-edit.php

    r58457 r58571  
    736736                    $h    = $size['height'];
    737737
    738                     $scale = isset( $sel->r ) ? $sel->r : 1 / _image_get_preview_ratio( $w, $h ); // Discard preview scaling.
     738                    $scale = 1 / _image_get_preview_ratio( $w, $h ); // Discard preview scaling.
    739739                    $image->crop( (int) ( $sel->x * $scale ), (int) ( $sel->y * $scale ), (int) ( $sel->w * $scale ), (int) ( $sel->h * $scale ) );
    740740                } else {
    741                     $scale = isset( $sel->r ) ? $sel->r : 1 / _image_get_preview_ratio( imagesx( $image ), imagesy( $image ) ); // Discard preview scaling.
     741                    $scale = 1 / _image_get_preview_ratio( imagesx( $image ), imagesy( $image ) ); // Discard preview scaling.
    742742                    $image = _crop_image_resource( $image, $sel->x * $scale, $sel->y * $scale, $sel->w * $scale, $sel->h * $scale );
    743743                }
Note: See TracChangeset for help on using the changeset viewer.