Comments (20)
Could you try the fixed syntax:
let data: NSData? = UIImageJPEGRepresentation(imageToSave, 0.7)
In addition, if the imageToSave
cannot obtain the jpeg image data, it will return nil. In this case, try to replace UIImageJPEGRepresentation
with UIImagePNGRepresentation
.
from dkimagepickercontroller.
I have another question, how could I get the NSURL of the photo choosed?
from dkimagepickercontroller.
Hi @Boli-CS
Why do you want to do this?
from dkimagepickercontroller.
Why the fetchImageWithSize method return other size??
from dkimagepickercontroller.
and how can I get NSData from AVURLAsset?
from dkimagepickercontroller.
Hi @Casporro
You can get NSData from AVURLAsset like this:
assets.first?.fetchAVAssetWithCompleteBlock({ (avAsset) -> Void in
let data = NSData(contentsOfURL: avAsset!.URL)
print(data)
})
from dkimagepickercontroller.
For the _Why the fetchImageWithSize method return other size??_
It's my fault! Fixed in 78d4e8c :)
from dkimagepickercontroller.
Thank you @zhangao0086, nice library and nice work.
I will use exporter to export video to something compatible with iOS and Android.
from dkimagepickercontroller.
Can you tell me how can I get a thumbnail from avAsset?
from dkimagepickercontroller.
@Casporro
Try using AVAssetImageGenerator
.
See also:http://stackoverflow.com/questions/8906004/thumbnail-image-of-video
from dkimagepickercontroller.
hi zhangao0086,
Nice work..Thanks for sharing.
i want to ask some questions
How can i get images from assets ?
Can you write a little sample code ?
from dkimagepickercontroller.
Hi @melihkeskin
Try this:
assets.first?.fetchFullScreenImageWithCompleteBlock({ image in
print(image)
})
from dkimagepickercontroller.
Hello again :),
thank you for your reply
is it only first image isnt it?
what can i do multiple picking ?
and last question :)
how can i get didFinishPickingMediaWithInfo
from dkimagepickercontroller.
@melihkeskin
You can do this:
var images: [UIImage] = []
for asset in assets {
asset.fetchFullScreenImageWithCompleteBlock({ image in
images.append(image!)
if images.count == assets.count {
print("done")
}
})
}
Why do you want to get didFinishPickingMediaWithInfo
? It's a delegate method of UIImagePickerController
, so it's never called in this library.
from dkimagepickercontroller.
Thank for help. I want to get metadata of the images.
I find many sample on the internet but generally they used in the didfinishpickingmediawithinfo. İf you can know other way please tell
from dkimagepickercontroller.
@melihkeskin
If you need to get the metadata of a DKAsset, just access the originalAsset
like so:
if let originalAsset = asset.originalAsset {
originalAsset.mediaType
originalAsset.mediaSubtypes
originalAsset.creationDate
originalAsset.modificationDate
// ...
}
See also: Reading Asset Metadata
from dkimagepickercontroller.
Hello zhangao0086,
i appreciate you. You are really good my friend.
Thanks for everything.
Nice work.
from dkimagepickercontroller.
@melihkeskin
I’m glad that helped you :)
from dkimagepickercontroller.
hi zhangao0086,
im following ur answer to melihkeskin and it not works (pic below), why i got this error?
from dkimagepickercontroller.
In 3.0.4, I've updated the fetchImage...
interface:
the completeBlock: (image: UIImage?) -> Void
was changed to completeBlock: (image: UIImage?, info: [NSObject : AnyObject]?) -> Void
so you need to change:
asset.fetchImageWithSize(size, completeBlock: { image in
// ...
})
to:
asset.fetchImageWithSize(size, completeBlock: { image, info in
// ...
})
from dkimagepickercontroller.
Related Issues (20)
- adding Ukrainian localization (uk)
- How to display overlay image on camera
- ios 14.6 not getting all the selected images HOT 1
- How to change color of selected images HOT 6
- Top picker bar is transparent in iOS15
- Camera icon not showing when deploying in xcode13 HOT 3
- Localization not working
- Compilation error: "LLVM ERROR: out of memory" HOT 11
- Xcode 13.3 - Error (Xcode): Segmentation fault: 11 Encountered error while archiving for device. HOT 35
- Crash on DKCamera.captureImage function HOT 1
- How to get original files URLs?
- Xcode 14: Swift Compiler Error: Stored properties cannot be marked potentially unavailable with '@available' HOT 4
- ios error Signing for "DKImagePickerController-DKImagePickerController" requires a development team. HOT 14
- After changing to 4.3.4, Now i cant compile with BITCODE enabled HOT 4
- XCode 14 Build error: Stored properties cannot be marked potentially unavailable with '@available' HOT 16
- I want to export the video to .mp4
- xcode14中不兼容ios12系统
- No Actions when clicking in Camera Icon, it should open camera to capture
- How to perform Multiple Image selection but only single video selection
- Xcode 13 升级 14后,运行到真机没有问题但是打包会报错 HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from dkimagepickercontroller.