jamesmontemagno/MediaPlugin

Picking multiple large images crashes app

shaileylalwani opened this issue · 3 comments

Hello, I'm using this plugin in my application and when I pick multiple large images such as 44 MB + 25+MB etc. from photo gallery and the application crashes.
The stacktrace for the crash is attached herewith if that could help.
IOS-227-iYQrsSvAorjVkBERw_k0-callstack.txt

This may not be a permanent solution but the multi-image picker can be a heavy handed on memory when the post-image processing options are enabled. I use these options for smallest memory overhead

// Get photos from library/gallery
List<MediaFile> ChosenLibraryPhotos = await CrossMedia.Current.PickPhotosAsync(new PickMediaOptions
{
    RotateImage = false,
    PhotoSize = PhotoSize.Full,
    CompressionQuality = 100
})

Thanks for the solution @MatthewKapteyn but it is not working

Nuts. I took a closer look at the stacktrace and it's running into memory problems as soon as it tries to read the selected image into memory.

At this point, there's two forks of this plugin that use drastically different picker controllers that might be more memory friendly and cause less problems for you.

https://github.com/bpater-tp/MediaPlugin

Replaces the ELC controller completely with GMImagePicker

https://github.com/matthewkapteyn/MediaPlugin

Uses ELC Controller for iOS 13 and below, PHPicker for iOS 14 and up.