Skip to content

Commit 9148620

Browse files
chenfadafbfacebook-github-bot-9
authored and
facebook-github-bot-9
committed
fix an image cropping bug when displaySize is specified
Summary:Diff D2647083 cleaned up image editing related logics and introduced an image cropping bug. The bug is that the result of the image cropping will be wrong if displaySize is specified. In particular, in Ads Manager App, we generate thumbnail by calling the image cropping function with displaySize set. With this bug, the thumbnail we get is not correct. This diff fixed the bug by replacing `image` with `croppedImage`. It should be a typo from D2647083 Reviewed By: zjj010104 Differential Revision: D2947730 fb-gh-sync-id: df7c7f3ddac5b053425db884f808e27b8418116e shipit-source-id: df7c7f3ddac5b053425db884f808e27b8418116e
1 parent 82eeca6 commit 9148620

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

Libraries/Image/RCTImageEditingManager.m

+2-2
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,8 @@ @implementation RCTImageEditingManager
6262
targetSize = [RCTConvert CGSize:cropData[@"displaySize"]]; // in pixels
6363
RCTResizeMode resizeMode = [RCTConvert RCTResizeMode:cropData[@"resizeMode"] ?: @"contain"];
6464
targetRect = RCTTargetRect(croppedImage.size, targetSize, 1, resizeMode);
65-
transform = RCTTransformFromTargetRect(image.size, targetRect);
66-
croppedImage = RCTTransformImage(image, targetSize, image.scale, transform);
65+
transform = RCTTransformFromTargetRect(croppedImage.size, targetRect);
66+
croppedImage = RCTTransformImage(croppedImage, targetSize, image.scale, transform);
6767
}
6868

6969
// Store image

0 commit comments

Comments
 (0)