Open worldlyjohn opened 7 years ago
in my research i also came across Intro to Photo Framework where they mention how images can be requested in new sizes letting PhotoKit handle the heavy lifting.
Image Sizing and Cropping Curiously, the parameters regarding the sizing and cropping of the result image are spread across two places. The targetSize and contentMode parameters are passed directly into the requestImageForAsset(...) method. The content mode describes whether the photo should be aspect-fitted or aspect-filled into the target size, similar to UIView’s contentMode. Note: If the photo should not be resized or cropped, pass PHImageManagerMaximumSize and PHImageContentMode.Default.
Additionally, PHImageRequestOptions provides means of specifying how the image manager should resize. The resizeMode property can be set to .Exact (when the result image must match the target size), .Fast (more efficient than .Exact, but the resulting image might differ from the target size), or .None. Furthermore, the normalizedCroppingMode property lets us specify how the image manager should crop the image. Note: If normalizedcroppingMode is provided, set resizeMode to .Exact.
module uses PHAsset, but is fetching using older method
fetchAssetsWithALAssetURLs
.This will fail for PHAssets where protocol is
ph://
. Instead we should usefetchAssetsWithLocalIdentifiers
which is referenced below.See RCTPhotoLibraryImageLoader.m#L52