congnd / fmphotopicker Goto Github PK
View Code? Open in Web Editor NEWA modern, simple and zero-dependency photo picker with an elegant and customizable image editor
License: MIT License
A modern, simple and zero-dependency photo picker with an elegant and customizable image editor
License: MIT License
Your use of the term ForceCrop was not what I expected. In my use case I am having a user pick a profile pic that will be circular, so I need to force them to edit their selected photo with a circle crop. It took me awhile to understand why turning on forceCrop didn't result in that behavior, but rather forces a single crop option. IMHO ForceCrop should be named CropChoice or CropDefault.
This is an amazing framework, thank you for open sourcing it.
When I select multiple photos, then edit them, sometimes FMLoadingView can't hide and delegate method "didFinishPickingPhotoWith" can't response after tapping done button.Then, I set a breakpoint in DispatchQueue.main.async, and I found sometimes the code didn't enter into.
ps: my device is iPhone6,iOS12.2.
` private func processDetermination() {
FMLoadingView.shared.show()
var dict = [Int:UIImage]()
DispatchQueue.global(qos: .userInitiated).async {
let multiTask = DispatchGroup()
for (index, element) in self.dataSource.getSelectedPhotos().enumerated() {
multiTask.enter()
element.requestFullSizePhoto(cropState: .edited, filterState: .edited) {
guard let image = $0 else { return }
dict[index] = image
multiTask.leave()
}
}
multiTask.wait()
let result = dict.sorted(by: { $0.key < $1.key }).map { $0.value }
DispatchQueue.main.async {
FMLoadingView.shared.hide() // set a breakpoint
self.delegate?.fmPhotoPickerController(self, didFinishPickingPhotoWith: result)
}
}
}`
Finally, I found the code "guard let image = $0 else { return }" has a bug.Because sometimes image is nil after call back , it leads to that enter() and leave() don't match, and "multiTask.wait()" will not work.
it's detail said support video, but it's delegate just return photos: [UIImage]
, i hope it's support images and videos
Now I added
👉🏻 https://github.com/HanSJin/FMPhotoPicker
Lets Clone and modify
or import pod
pod 'FMPhotoPicker', :git => 'https://github.com/HanSJin/FMPhotoPicker.git', :commit => '20f6b5f9a84a11e53a9a68b39a648b2fc167f5f1'
And I will develop below later
When I present the picker, the UI loads up very slowly, and if I tap on the top bar it immediately goes to the very first photo of my photo library, which makes me believe it loaded up the entire library's thumbnails upon opening, and that's probably the major cause of the slowless. Could we make the load paginated and only load more as we scroll up?
I have used SPM to manage all my dependencies.
func openPicker() {
var config = FMPhotoPickerConfig()
config.selectMode = .single
config.mediaTypes = [.image]
config.forceCropEnabled = true
config.availableCrops = [FMCrop.ratioSquare]
let picker = FMPhotoPickerViewController(config: config)
picker.delegate = self
self.present(picker, animated: true)
}
func fmPhotoPickerController(_ picker: FMPhotoPickerViewController, didFinishPickingPhotoWith photos: [UIImage]) {
picker.dismiss(animated: true, completion: nil)
picker.dismiss(animated: true, completion: nil)
if photos.count > 0 {
upload(image: photos.first!)
}
}
I want to dismiss the picker after I didFinishPicking, it will call didFinishPicking
delegate after I edited my picture, and the dismiss can not dismiss the picker. It's still in the picker page where to select an image.
And then I tap the finish in the first page of the picker, it will call didFinishPicking
delegate and then dismiss the picker.
It will call twice didFinishPicking
delegate method in my one select and edit
. And I can not dismiss the picker with one dismiss.
So I use two dismiss to dismiss the picker.
lack of support for contrast, brightness, temperature, saturation, sharpening etc. settings
Hi,
I really appreciate the tremendous work you did. I have couple of extra filters to be added on the slider. However I'm not sure how to add them using FMFilterable. I tried several things but truly speaking couldn't manage smoothly.
If you can support with an example, I really appreciate for that.
Thank you,
Baris
crash fix replace old init method with this one
private init() {
if let rootVC = (UIApplication.shared.windows.first?.rootViewController) {
self.transparentView = UIView(frame: rootVC.view.frame)
} else {
let windowFrame = UIApplication.shared.keyWindow?.frame
self.transparentView = UIView(frame: windowFrame ?? .zero)
}
self.transparentView.backgroundColor = UIColor(white: 0, alpha: 0.4)
self.indicator = UIActivityIndicatorView(frame: CGRect(x: 0, y: 0, width: 35, height: 35))
self.indicator.center = self.transparentView.center
self.indicator.color = .white
self.transparentView.addSubview(self.indicator)
}
Dear Mr. Nguyen,
My name is Anupama Nedungadi and I am a Master’s student at the University of Geneva. For my thesis, I am looking at internationalization and localization practices in open source image editors, meaning how and why (or why not) the software has been translated into another language.
I have curated a list of image editors, graphic editors and the likes hosted on SourceForge, GitHub and GitLab, and this list includes your software congnd/FMPhotoPicker.
I am contacting you to ask for your participation in a survey. This is a key element of my Master’s thesis. I am aware of the fact that we don't know each other and that you don't owe me anything, but I am really dependent on your help since my topic is quite niche. I also believe we should shine a spotlight on open source software and its translation in particular, as little research has been done in this area recently.
The survey will be open until the 16th of June 2021, and it should only take you around 10 minutes as most questions are multiple choice. Your answers will be anonymous.
https://formulaire.unige.ch/outils/limesurveyfac/traduction-interpretation/index.php/697247?lang=en
Again, thank you for taking the time to read this email and helping a slightly stressed student out!
Best regards,
Anupama Nedungadi
Hi,
Is adding Dark Mode a possibility for the picker? I've had a few of my app's users ask about this, and just wanted to check if there's a way I can enable this (or if you're able to add it in an update).
Thanks in advance, and I hope you're well :)
please add a filter category
First of all, thanks for this repo! Great job overall, and very useful.
This is more of a request than an issue, but it'd be nice for the fonts and colors used throughout FMPhotoPicker to be configurable. The kBlackColor
, kRedColor
, etc. could be exposed to the Config object, perhaps? Not sure the best way to go about the fonts, however.
Use case: utilizing FMPhotoPicker in another app that doesn't necessarily conform to UI fonts and colors. Also, the kRedColor
isn't the best UI color, since it's more of an "error" color than a state color, if that makes sense.
Step
Is there a way to know the editing was cancelled? There is only a FMImageEditorViewControllerDelegate method to notify editing finish event, but not editing cancel event with the delegate methods.
There is an existing issue with UIImagePickerController when the a view is present and dismissed from over it. Below are the steps to reproduce it.
To work around this issue, I would like to dismiss the camera screen and present a fresh instance when editing is cancelled, but there is no way to know this from the library.
'Could not load NIB in bundle: 'NSBundle </var/containers/Bundle/Application/.app/Frameworks/FMPhotoPicker.framework> (loaded)' with name 'FMPhotoPickerViewController''
Do you plan to add support for picking video like in system picker?
I mean smth like this:
func fmPhotoPickerController(_ picker: FMPhotoPickerViewController, didFinishPickingVideoWith videos: [URL]) { }
second time when open the app its not asking keep the current selection or select more photos ,permission
When trying to present FMPhotoPickerViewController got an error
*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Could not load NIB in bundle: 'NSBundle </private/var/containers/Bundle/Application/3AFB974F-E9E0-4678-864B-5716806E8E46/Tuja.app> (loaded)' with name 'FMPhotoPickerViewController''
*** First throw call stack:
(0x1aeb8d5f0 0x1ae8afbcc 0x1aea83b28 0x1b28ccd5c 0x1b25f686c 0x1b25f72e4 0x1b25f759c 0x1b25f7ca0 0x1b260d31c 0x1b260610c 0x1b2607b08 0x1b260a014 0x1b260a51c 0x1b2609f64 0x1b260a1d0 0x102743f94 0x102746240 0x102740e30 0x1e605712c 0x1e6140924 0x1e633fdec 0x1e61b62ac 0x1e61b62c8 0x1e61b62ac 0x1e61a9cfc 0x1e61a98a8 0x1e61e6068 0x1e64a25b8 0x1e64a2800 0x1e64a2e14 0x1b2815380 0x1b2cb8bf0 0x1b280ae5c 0x1b280af6c 0x1b280add4 0x1b2c749fc 0x1b2c506a0 0x1b2cd0d84 0x1b2cd38bc 0x1b2ccb8d0 0x1aeb0bb64 0x1aeb0babc 0x1aeb0b244 0x1aeb06274 0x1aeb05c34 0x1b8c4f38c 0x1b2c3822c 0x10273e2cc 0x1ae98d800)
libc++abi.dylib: terminating with uncaught exception of type NSException
Xcode 11.5
Installed via SPM
Hi. The library is awesome! But Someone, like me, only need cropper, or someone only need filter, or others don't need both. Maybe you can offer a option as FMPhotoPickerConfig. I mean it's easy to do this. Thx.
Hi.
Tribal Media House(@tribalmedia) decide owner change to Cong Nguyen(@congnd).
please keep maintaining this repository.
thanks a looooooooooooooooot!!!!!
If you allow it, I will develop. thanks~
Would be a key feature for us to adopt this lib!
static func showDialog(in viewController: UIViewController,
ok: (() -> Void)? = nil,
cancel: (() -> Void)? = nil,
title: String = "FMPhotoPicker",
message: String = "FMPhotoPicker want to access Photo Library") {
let alertController = UIAlertController(title: title, message: message, preferredStyle: .alert)
alertController.addAction(UIAlertAction(title: "OK", style: .default, handler: { _ in ok?() }))
alertController.addAction(UIAlertAction(title: "キャンセル", style: .cancel, handler: { _ in cancel?() }))
viewController.present(alertController, animated: true)
}
Code needs updating
The xcassets couldn't be loaded in the main app target, and there seems to be ways around it: https://stackoverflow.com/questions/33063233/cant-load-images-from-xcasset-in-cocoapods
FMCrop.ratioCustom
is available even I put only FMCrop.ratioSquare
and/or forceCropEnabled = true
When I move to Edit image screen, any of FMCrops are not selected and it gives me the opportunity to crop an image as FMCrop.ratioCustom
Hi, how I can remove filter and left only crop image editer
We need changelog in this beautiful Repo.
PLease add an option to capture image using camera and edit along with pick from galley option
When I use FMPhotoPicker select video asset, this method func requestAVAsset(asset: PHAsset, complete: @escaping (AVAsset?) -> Void)
always return a nil asset and the player won't be initialized, tap play button and nothing happends , a fews seconds later the app crash because some UI modifications performed from a background thread, I try to fix first problem by adding an option to PHImageManager and it works:
let manager = PHImageManager.default()
let option = PHVideoRequestOptions()
option.isNetworkAccessAllowed = true
manager.requestAVAsset(forVideo: asset, options: option) { asset, audioMix, _ in
DispatchQueue.main.async {
complete(asset)
}
}
hope help, and the other problem I took a screenshot for your reference,hope useful:
It would great localize this alert, title and buttons :)
let alert = UIAlertController(title: "Are you sure you want to cancel?", message: nil, preferredStyle: .alert)
config = FMPhotoPickerConfig()
config.selectMode = .multiple
config.mediaTypes = [.image]
config.maxImage = 20
config.maxVideo = 0
there is no option for disable edit photo in FMPhotoPickerViewController
FMWarningView
line 28
let rootVC = (UIApplication.shared.delegate?.window??.rootViewController)!
That's because the window property belongs to the scene delegate, not the app delegate.
How to hide Edit Button , disable photo edit ,just show origin image
Hello, I get the following error when building with carthage update --platform iOS
and having git "[email protected]:congnd/FMPhotoPicker.git"
in Cartfile:
Module compiled with Swift 5.2.4 cannot be imported by the Swift 5.3 compiler
I use Xcode version 12.0.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.