Giter Site home page Giter Site logo

Comments (20)

zhangao0086 avatar zhangao0086 commented on June 25, 2024

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.

Boli-CS avatar Boli-CS commented on June 25, 2024

I have another question, how could I get the NSURL of the photo choosed?

from dkimagepickercontroller.

zhangao0086 avatar zhangao0086 commented on June 25, 2024

Hi @Boli-CS
Why do you want to do this?

from dkimagepickercontroller.

Casporro avatar Casporro commented on June 25, 2024

Why the fetchImageWithSize method return other size??

from dkimagepickercontroller.

Casporro avatar Casporro commented on June 25, 2024

and how can I get NSData from AVURLAsset?

from dkimagepickercontroller.

zhangao0086 avatar zhangao0086 commented on June 25, 2024

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.

zhangao0086 avatar zhangao0086 commented on June 25, 2024

For the _Why the fetchImageWithSize method return other size??_

It's my fault! Fixed in 78d4e8c :)

from dkimagepickercontroller.

Casporro avatar Casporro commented on June 25, 2024

Thank you @zhangao0086, nice library and nice work.
I will use exporter to export video to something compatible with iOS and Android.

from dkimagepickercontroller.

Casporro avatar Casporro commented on June 25, 2024

Can you tell me how can I get a thumbnail from avAsset?

from dkimagepickercontroller.

zhangao0086 avatar zhangao0086 commented on June 25, 2024

@Casporro
Try using AVAssetImageGenerator.
See also:http://stackoverflow.com/questions/8906004/thumbnail-image-of-video

from dkimagepickercontroller.

melihkeskin avatar melihkeskin commented on June 25, 2024

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.

zhangao0086 avatar zhangao0086 commented on June 25, 2024

Hi @melihkeskin
Try this:

assets.first?.fetchFullScreenImageWithCompleteBlock({ image in
    print(image)
})

from dkimagepickercontroller.

melihkeskin avatar melihkeskin commented on June 25, 2024

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.

zhangao0086 avatar zhangao0086 commented on June 25, 2024

@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.

melihkeskin avatar melihkeskin commented on June 25, 2024

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.

zhangao0086 avatar zhangao0086 commented on June 25, 2024

@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.

melihkeskin avatar melihkeskin commented on June 25, 2024

Hello zhangao0086,

i appreciate you. You are really good my friend.
Thanks for everything.
Nice work.

from dkimagepickercontroller.

zhangao0086 avatar zhangao0086 commented on June 25, 2024

@melihkeskin
I’m glad that helped you :)

from dkimagepickercontroller.

aldolazuardi avatar aldolazuardi commented on June 25, 2024

hi zhangao0086,
im following ur answer to melihkeskin and it not works (pic below), why i got this error?
screen shot 2016-01-12 at 3 52 42 pm

from dkimagepickercontroller.

zhangao0086 avatar zhangao0086 commented on June 25, 2024

Hi @aldolazuardi

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.