[wp-trac] [WordPress Trac] #61514: Media attachments REST API endpoint: Fix cropping on one axis only

WordPress Trac noreply at wordpress.org
Tue Jul 9 13:05:41 UTC 2024


#61514: Media attachments REST API endpoint: Fix cropping on one axis only
-------------------------------------------------+-------------------------
 Reporter:  andrewserong                         |       Owner:
                                                 |  SergeyBiryukov
     Type:  defect (bug)                         |      Status:  closed
 Priority:  normal                               |   Milestone:  6.6
Component:  REST API                             |     Version:  trunk
 Severity:  normal                               |  Resolution:  fixed
 Keywords:  has-patch has-unit-tests dev-        |     Focuses:
  reviewed                                       |
-------------------------------------------------+-------------------------
Changes (by davidbaumwald):

 * status:  reopened => closed
 * resolution:   => fixed


Comment:

 In [changeset:"58692" 58692]:
 {{{
 #!CommitTicketReference repository="" revision="58692"
 REST API: Correct image cropping tools in the block editor.

 As of [58457], the width and height cropping values are cast to an integer
 before the comparison to see if the target width and height differ from
 the original width and height.
 Since they are now integers, it exposes a bug where the && of the if
 conditional meant that if you were only cropping in one dimension, the
 check wouldn't pass, and cropping would not occur.
 In the block editor, the cropping tools are aspect ratio based, so one of
 the dimensions will always match that of the source image. Therefore, now
 that the values are cast as integers, the condition that allows a cropping
 to occur needs to be updated. If either width or height is different from
 the source image, then a crop should be allowed.

 Follow-up to [50124], [58457].

 Reviewed by davidbaumwald.
 Merges [58612] to the 6.6 branch.

 Props andrewserong, jrf, kevin940726.
 Fixes #61514. See #59782.
 }}}

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/61514#comment:10>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list