zhangao0086 / dkimagepickercontroller Goto Github PK
View Code? Open in Web Editor NEWImage Picker Controller for iOS written in Swift 4 & 5.
License: MIT License
Image Picker Controller for iOS written in Swift 4 & 5.
License: MIT License
Is there any method or property by which we can skip Panorama and Live photos while presenting the picker controller.
Im just finding new ImagePicker controller and I found yours is very cool one. Is there any advice to use it from obj-c ?
Thx a lot.
// sry for my bad Eng and Knowledge.
Right now, if I select zero photos, the select button goes away and only cancel is available.
If the user already has photos selected and would like to remove all selected photos, I'd like to be able to select zero photos and push Done
. This is the current functionality in the Facebook iOS application, and I'd love to see that functionality make it's way into this library.
Thanks!
Hi @zhangao0086 thank you for great lib. I just wondering how to move image from dkasset to own custom class? thank you
Is there a way to disallow the user from seeing and selecting iCloud photos in the photo picker? I've discovered a problem when the user selects a photo from their library that hasn't been downloaded to the device yet. I'm not 100% sure that this means the photo is from iCloud and they are only seeing a small thumbnail preview in the picker.
Below are some scenarios to help you understand how I've determined that the failing photo is from iCloud or some other off-device storage.
Test Case 01:
Test Case 02:
Everything else has been great BTW! Nice work!
Is it possible to give [options] parameter to fetchAVAssetWithCompleteBlock method??
I can't fine document about it.
Give me some light.
Is there a way to change the default album to be displayed. That is, I want the Camera Roll to be the first thing a user sees.
If you have selected a number of photos and decide to deselect one (or more), the relative numbering of the rest of the photos does not get updated.
For example if you have selected 3 photos, and then deselect number 2, then the remaining two photos will still be numbered 1 and 3. Expected behaviour would be that number 3 would change to 2.
This also has the effect that when you then continue to select another photo, then there will be three photos with the numbers 1, 3 and 3.
I think it's better if fullScreenImage or fullResolutionImage return with the correct orientation
Hi . I m facing a problem . When i selected multiple photo e.x 18 photos selected ..It return me less photo instead of all.Here is my code
let pickerController = DKImagePickerController()
var images:[UIImage] = []
pickerController.didSelectAssets = { (assets: [DKAsset]) in
print(assets.count) // This return me exact same value which i select
for asset in assets {
asset.fetchOriginalImageWithCompleteBlock({ (image, info) -> Void in
print(image) //return less images
self.images.append(image!)
print(self.images.count) //Return less images count
})
}
}
self.presentViewController(pickerController, animated: true) {}
can u help me out . Am i wrong someWhere ?
I am using DKImagePickerController with all of the default settings.
After opening the picker, I select the camera button, then take a photo. This calls the didSelectAssets
block when the camera is dismissed. Then when I select the 'done' button, didSelectAssets
is called again.
In my didSelectAssets
block, I am appending the new images to my array, and because didSelectAssets
is called twice, a copy of the photo from the camera is added to my array.
I advocate that didSelectAssets
only be called once when the picker is dismissed. That way duplicates are not created if appending to an array, or resetting the array.
Please add the cancel button on picker, show that user can dismiss the picker for example by mistake user open the picker and don't want to select the image. or not want to select any image then he/she able to dismiss the picker on cancel button click. I know the done button click dismiss. But as per user experience we need add the "cancel" button.
Hello, Can I just start off by saying thank you for such an incredible project. I've created something similar but far less complicated. My question is this, Is it possible to call an image picker on view did load. For the demo that you provided in VIewController at view did load I called for your show method providing the needed specifications.
I end up getting an error <DKImagePickerControllerDemo.DKImagePickerController: 0x12582ee00> on <DKImagePickerControllerDemo.ViewController: 0x124e458f0> whose view is not in the window hierarchy!. Not sure where I am going wrong
override func viewDidLoad() {
super.viewDidLoad()
showImagePickerWithAssetType(
.AllAssets,
allowMultipleType: false,
sourceType: .Photo,
allowsLandscape: true,
singleSelect: false
)
}
invalid attempt to access <ALAssetPrivate: 0x7f8946220cd0> past the lifetime of its owning ALAssetsLibrary
fatal error: unexpectedly found nil while unwrapping an Optional value
How to solove it?
The framework crashes when i pick an image from iCloud library that apparently doesn't contain a fullResolution image, which therefore crashes my app.
It happens on line 30, where fullResolutionImage()
is called an force unwraps the fullResolutionImage but it is nil.
Running latest version 2.3.6
Hello Again,
I think there is a bug, in this scenario. Can you check this out?
hi
i have selected 20 images and each image size like 1.5 to 3 mb .after select 20 images it will show received memory warning and crash
in my app i m trying to delete selected photos from camera roll . I tried a lot . But could not figure it out. I also tried to take the value from info which is "PHImageFileURLKey" and delete using PHAsset.fetchAssetsWithALAssetURLs ..But its not working..so i wanna try fetchAssetsInAssetCollection which is looking for PHAssets instead of DKAssets....Thanks
First off all thank you for yours working. It is really amazing.
I did all steps which you write. It looks correctly but when I want to instance DKAsset or DKImagePickerController gives me the error undefined. I researched it and when I change the shcema on my project error fix and build success but in this case application is not run. I use swift in my project.
May you share something to me about how can ı import the framework and use it correctly in swift.
Thank you so much.
Best Regards.
I am trying out your wonderful ImagePicker in my new project. I am allowing users to select multiple images & hence in turn,when they select the images *I want to display the user the name of the images. How can I achieve that? *
For what it is worth, I'm using the version where you haven't created DKCamera, so I don't know if new versions fix this, but this is a problem I've run into. The only way to get rid of it is to close the app, reopen and then try again.
If I decide not to accept allowing access, I see the prompt again, it takes me to settings, but when I change the settings, then go back to app, the prompt is still there.
Does DKCamera fix this?
Edit: I just checked and DKCamera doesn't seem to have this fixed.
It looks like the 'showsCancelButton' flag is ignored if it's set before actually presenting the view controller. I think code in 'viewWillAppear' overrides it - so the only option is to set this flag after the view actually appears.
Your Swift2.0 branch is not working for me, when using it as a pod :(
I am using iPhone 6 plus with iOS 9.2.
If i want to add an option to capture a video, what changes should I make in takePicture method of DKCamera class in order to support this feature ?
Is it possible to get the images ordered by date instead of ordered by selection order?
Swift enums are not visible in Objective-C ( see more http://stackoverflow.com/a/24139544/426582 ).
To assetType be available also in Objective-C this enum must be changed to Struct.
Unfortunately I'm getting warnings left and right about how the AssetsLibrary is deprecated and certain methods need to be updated to the Photos framework; they all have to do with the originalAsset variable in the DKAsset class. Please fix this, I would but I'm new to iOS development :/
Can we have an intermediate view where the picture taken from camera will be shown along with the Accept and Cancel as the available options so that the user can discard the pic if see any issue with that
Hello, my question is about the pic, in the example select but is a thumbnail (low quality and small), How to select the image, video original from the library or camera?
Thanks
When using option for HighQualityFormat in Objective C, images never return.
Code as used (aSelected is array of selected images):
for (int i = 0; i < aSelected.count; i++)
{
CGSize imageSize=CGSizeMake(1153, 1153);
PHImageRequestOptions* options = [[PHImageRequestOptions alloc] init] ;
options.synchronous = YES;
options.version = PHImageRequestOptionsVersionCurrent;
options.deliveryMode = PHImageRequestOptionsDeliveryModeHighQualityFormat;
options.resizeMode=PHImageRequestOptionsResizeModeFast;
options.networkAccessAllowed = YES;
DKImageManager *cont = [DKImageManager new];
[cont fetchImageForAsset:aSelected[i] size:imageSize options:options completeBlock:^(UIImage * imageSelected, NSDictionary * info){
[self uploadContentImage:imageSelected];
}];
Is there an option to detect or keep the ratio when using this size one? In that case, the size specified would be the max height and the max width for the compressed image.
For example, if I specify the size to be CGSize(width: 1200, height: 1200), the image will always be cut into 1200 * 1200 square. If the original ratio is 4:3 and 2000:1500, I'd like to have the UIImage to be 1200 * 900. Thanks!
So, this is 95% there for it. There just isn't a way to click a pic -> Go to a crop view, then crop pic.
Further, it seems like you use a custom button for the Done as the right button for Navigation bar. Why don't you use the default .Done, which looks better? A tad redundant to number the selected pics on the pics and then have the selected number on the top right as well. It doesn't look very aesthetically pleasing like that and the reason someone would use this is for it to mimic 100% the functionality they're looking for.
Anyways, just an FYI, but I'll see if I can get a crop thing going and make a pull request.
sorry to say its not issue .plz help
Step to reproduce:
1. Open DKImagePickerController
2. Leave the app and open Photos app. Create or delete a album
3. Back to the application and tap on group button ==> app crash.
I can't get a video selected with this (url is asset.url):
let data = NSData(contentsOfURL: url!)
Always data returns nil
With the new version (3.0.0) I can't get NSData from assets... If I do this:
assets.first!.fetchImageWithSize(sender.view!.bounds.size, completeBlock: {
(image: UIImage?) -> Void in
if let imageToSave = image {
let data: NSData = UIImageJPEGRepresentation(imageToSave, 0.7) //data always nil
self.saveImage(data!)
}
}
data is always nil an image never is nil... What is the problem?
Hello,
This is not issue, just suggestion.
In system controller, there is a little camera icon and video duration bottom of the video thumbnails. Is it possible to do that with DKImagePickerController?
Hi!
I need to change image of first cell when select DKImagePickerControllerAssetType
Image selection is one other picture and filming is another image
When i select multi image at many album it got wrong number image selected.
Fix it please.
I have implemented this project via cocoa pods. I wanted to save the selected images (path) to an array and retrieve and upload in another view controller.
Failed to work out. Appreciate your help.
i am using DKImagePickerController then i select multipal image in self.assets!
like.[<DKImagePickerControllerDemo.DKAsset: 0x7fe168e34d70>, <DKImagePickerControllerDemo.DKAsset: 0x7fe168d3c020>, <DKImagePickerControllerDemo.DKAsset: 0x7fe168d71980>]
but how to convert data and post image
Hi,
Thanks for sharing wonderful library. I have just installed on my phone and it was crash when you choose photos only option from examples.
in DKAsset:
self.thumbnailImage = UIImage(CGImage:originalAsset.thumbnail().takeRetainedValue())
with error message "fatal error: unexpectedly found nil while unwrapping an Optional value"
Not sure what is reason but when I tried to open camera it was asking me permission but when it was allowed it was crashed again. No debug statment generated that time.
Let me know if you need more information for this issues.
Thanks
Manoj
Because you are using the AssetsLibrary instead of Photo Framework it is not easily possible to fetch PHAssets if the user selects images from "My photo stream" (see http://stackoverflow.com/questions/26480526/alassetslibrary-assetforurl-always-returning-nil-for-photos-in-my-photo-stream).
Is it possible to hide the album "my photo stream" or better: have you considered to switch to Photo Framework?
should be version check..
Another issue is this method... the code inside block executes twice for each asset...
image.fetchFullScreenImageWithCompleteBlock({
(image: UIImage?) -> Void in
//code here executes twice for each asset
})
I have a problem with the second and next times after first execution of picker, the problem occurs with this picker configuration:
let pickerController = DKImagePickerController()
pickerController.allowMultipleTypes = false
pickerController.assetType = .allPhotos
pickerController.singleSelect = true
pickerController.maxSelectableCount = 1
The next executions of the code increases the assets in pickerController.didSelectAssets = { [unowned self] (assets: [DKAsset]) in
with the previous asset or assets...
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.