Skip to content

Commit

Permalink
[MODIFY] limit image size to fetch in order to reduce memory use
Browse files Browse the repository at this point in the history
  • Loading branch information
c-nguyen committed Apr 12, 2018
1 parent 720c757 commit c95a487
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion FMPhotoPicker/FMPhotoPicker/source/Data/FMPhotoAsset.swift
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ public class FMPhotoAsset {

func requestFullSizePhoto(cropState: FMImageEditState, filterState: FMImageEditState, complete: @escaping (UIImage?) -> Void) {
if let asset = asset {
self.fullSizePhotoRequestId = Helper.getFullSizePhoto(by: asset) { image in
self.fullSizePhotoRequestId = Helper.getPhoto(by: asset, in: CGSize(width: 2000, height: 2000)){ image in
self.fullSizePhotoRequestId = nil
if self.canceledFullSizeRequest {
self.canceledFullSizeRequest = false
Expand Down
2 changes: 1 addition & 1 deletion FMPhotoPicker/FMPhotoPicker/source/Utilities/Helper.swift
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ class Helper: NSObject {
let newSize = CGSize(width: desireSize.width,
height: desireSize.height)

let pId = manager.requestImage(for: photoAsset, targetSize: newSize, contentMode: .aspectFill, options: options, resultHandler: { result, _ in
let pId = manager.requestImage(for: photoAsset, targetSize: newSize, contentMode: .aspectFit, options: options, resultHandler: { result, _ in
complete(result)
})
// manager.cancelImageRequest(pId)
Expand Down

0 comments on commit c95a487

Please sign in to comment.