hyperoslo / ImagePicker

:camera: Reinventing the way ImagePicker works.
Other
4.87k stars 678 forks source link

Added the ability to save photos without loss of location and exif metadata, fixed several bugs #416

Closed raketenok closed 4 years ago

raketenok commented 6 years ago
  1. Added the ability to save photos without loss of location and exif metadata (Now the photo album stores the data. (which store the exif metadata and the gps coordinates) not UIImage. If you set the quality of the photo (ImagePickerController.photoQuality = AVCaptureSession.Preset.photo), then after creating the snapshot, we will call the delegates (func wrapperDidPress(images: [(imageData: Data,location: CLLocation?)]) func doneButtonDidPress(images: [(imageData: Data,location: CLLocation?)])), which will return the data. If the picture quality is not set in advance, the old delegate method will be called
  2. Fixed bug when clicking and dragging(outside the photo button)
  3. Fixed bugs when clicking the Done/Cancel/PhotoStack button again
ElectroBuddha commented 6 years ago

I have merged this pull request into my fork. There is an issue when tapping on 'wrapper' button when no images are selected:

After quick analysis, I have found out that your method resolveAssets(_ assets:, imagesClosers: ) does not call 'imagesClosers' callback in case when 'assets' array is empty. Fixed it by adding this line before for asset in assets {...} loop:

guard !assets.isEmpty else { return imagesClosers(imagesData) }

Also, could you please pass 'imagePicker' reference in your new delegate methods wrapperDidPress(images: [(imageData: Data,location: CLLocation?)]) and doneButtonDidPress(images: [(imageData: Data,location: CLLocation?)]) so that they have similar signature as original delegate methods, because the host application might need that reference inside delegate methods.

raketenok commented 6 years ago

Fixed, you can review

sedwo commented 6 years ago

@raketenok Can you please update the ImagePickerDemo to demonstrate your changes, as it currently breaks things. Also, the variable open static var photoQuality: AVCaptureSession.Preset? is never set anywhere, which never triggers your new wrapperDidPress and doneButtonDidPress delegates. Unless I'm missing something.

fyi: https://github.com/sedwo/ImagePicker/commit/a75cbf81df6987aa26b5549a3b7a0f4b6339fb28

raketenok commented 6 years ago

I added a description, made the methods optional and updated the demo