Changeset 58457
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-admin/includes/image-edit.php
r58456 r58457 737 737 738 738 $scale = isset( $sel->r ) ? $sel->r : 1 / _image_get_preview_ratio( $w, $h ); // Discard preview scaling. 739 $image->crop( $sel->x * $scale, $sel->y * $scale, $sel->w * $scale, $sel->h * $scale);739 $image->crop( (int) ( $sel->x * $scale ), (int) ( $sel->y * $scale ), (int) ( $sel->w * $scale ), (int) ( $sel->h * $scale ) ); 740 740 } else { 741 741 $scale = isset( $sel->r ) ? $sel->r : 1 / _image_get_preview_ratio( imagesx( $image ), imagesy( $image ) ); // Discard preview scaling. -
trunk/src/wp-includes/rest-api/endpoints/class-wp-rest-attachments-controller.php
r58447 r58457 622 622 $size = $image_editor->get_size(); 623 623 624 $crop_x = round( ( $size['width'] * $args['left'] ) / 100.0 );625 $crop_y = round( ( $size['height'] * $args['top'] ) / 100.0 );626 $width = round( ( $size['width'] * $args['width'] ) / 100.0 );627 $height = round( ( $size['height'] * $args['height'] ) / 100.0 );624 $crop_x = (int) round( ( $size['width'] * $args['left'] ) / 100.0 ); 625 $crop_y = (int) round( ( $size['height'] * $args['top'] ) / 100.0 ); 626 $width = (int) round( ( $size['width'] * $args['width'] ) / 100.0 ); 627 $height = (int) round( ( $size['height'] * $args['height'] ) / 100.0 ); 628 628 629 629 if ( $size['width'] !== $width && $size['height'] !== $height ) { -
trunk/tests/phpunit/tests/rest-api/rest-attachments-controller.php
r58447 r58457 2377 2377 $this->assertCount( 1, WP_Image_Editor_Mock::$spy['crop'] ); 2378 2378 $this->assertSame( 2379 array( 320 .0, 48.0, 64.0, 24.0),2379 array( 320, 48, 64, 24 ), 2380 2380 WP_Image_Editor_Mock::$spy['crop'][0] 2381 2381 );
Note: See TracChangeset
for help on using the changeset viewer.