Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Original Picture #26

Closed
josaal17 opened this issue Oct 5, 2015 · 4 comments
Closed

Original Picture #26

josaal17 opened this issue Oct 5, 2015 · 4 comments

Comments

@josaal17
Copy link

josaal17 commented Oct 5, 2015

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

@zhangao0086
Copy link
Owner

Hi @josaal17
You can use asset.fullResolutionImage or asset.fullScreenImage for image. For video, do you want to get the video as NSData?

@josaal17
Copy link
Author

Thanks, it's works!!

@josaal17 josaal17 reopened this Oct 16, 2015
@josaal17
Copy link
Author

I'm sorry, I had not seen the other question!, Yes i need get the video as NSData!

@zhangao0086
Copy link
Owner

Hi @josaal17

The originalAsset becomes public property in 2.3.0, now you can get the raw data of the selected assets like this:

pickerController.didSelectAssets = { [unowned self] (assets: [DKAsset]) in
    print("didSelectAssets")
    print(assets.map({ $0.url}))

    if let rep = assets.first?.originalAsset?.defaultRepresentation() {
        let sizeOfRawDataInBytes = Int(rep.size())
        let rawData = NSMutableData(length: sizeOfRawDataInBytes)!
        let bufferPtr = rawData.mutableBytes
        let bufferPtr8 = UnsafeMutablePointer<UInt8>(bufferPtr)

        rep.getBytes(bufferPtr8, fromOffset: 0, length: sizeOfRawDataInBytes, error: nil)
        print(rawData)
    }

    self.assets = assets
    self.previewView?.reloadData()
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants