phasset

How to get URL for a PHAsset? [duplicate]

青春壹個敷衍的年華 提交于 2019-11-26 23:16:45
问题 This question already has answers here : How to get an ALAsset URL from a PHAsset? (5 answers) Closed 2 years ago . I am using a third party library to select multiple images from the Photo Library. On selecting multiple images it returns an array of PHAsset objects. Now, I want to save the URL (or some reference) for these objects in the core data. But I do not know how to get the URL. Is there any other reference I could store in the core data which could help me in fetching the same image

Save images with phimagemanager to custom album?

为君一笑 提交于 2019-11-26 19:43:55
I am making an app that takes pictures with AVFoundation and I want to save them to a custom album that I can then query and show in my app. (I'd prefer to not have them in the general photo roll, unless the user wants that) I can't really find anything showing how to do this in Swift... or at all. Is there a different way I am supposed to do this? I found this example on SO but it doesn't make sense to me and I can't get it to work. func savePhoto() { var albumFound : Bool = false var assetCollection: PHAssetCollection! var photosAsset: PHFetchResult! var assetThumbnailSize:CGSize! // Create

How to get an ALAsset URL from a PHAsset?

。_饼干妹妹 提交于 2019-11-26 18:58:37
You can do it sneakily† using the undocumented PHAsset.ALAssetURL property, but I'm looking for something documented. † In Objective-C, this will help @interface PHAsset (Sneaky) @property (nonatomic, readonly) NSURL *ALAssetURL; @end holtmann Create the assetURL by leveraging the localidentifier of the PHAsset . Example: PHAsset.localidentifier returns 91B1C271-C617-49CE-A074-E391BA7F843F/L0/001 Now take the 32 first characters to build the assetURL, like: assets-library://asset/asset.JPG?id=91B1C271-C617-49CE-A074-E391BA7F843F&ext=JPG You might change the extension JPG depending on the UTI

How to fetch all images from custom Photo Album - swift

做~自己de王妃 提交于 2019-11-26 16:37:50
问题 How to fetch all images from custom Photo Album? var fetchOptions = PHFetchOptions() fetchOptions.sortDescriptors = [NSSortDescriptor(key:"creationDate", ascending: false)] fetchOptions.predicate = NSPredicate(format: "mediaType = %d", PHAssetMediaType.Image.rawValue) let allImages:PHFetchResult = PHAsset.fetchKeyAssetsInAssetCollection(albumList[index].collection, options: fetchOptions) This code block is fetching just few of them. Thanks. -> albumList[index].collection 's type is

iOS8 Photos Framework: How to get the name(or filename) of a PHAsset?

ぐ巨炮叔叔 提交于 2019-11-26 11:06:21
问题 Im trying to get the image name using PHAssets . But I couldn\'t find metadata for filename or any method to get the image name. Is there a different way to get the file name? 回答1: If you want to get the image name (for example name of last photo in Photos) like IMG_XXX.JPG, you can try this: PHAsset *asset = nil; PHFetchOptions *fetchOptions = [[PHFetchOptions alloc] init]; fetchOptions.sortDescriptors = @[[NSSortDescriptor sortDescriptorWithKey:@"creationDate" ascending:YES]]; PHFetchResult

NSURL from PHAsset

牧云@^-^@ 提交于 2019-11-26 10:56:18
问题 I\'m converting our app over to use the Photos Framework of iOS8, the ALAsset framework is clearly a second class citizen under iOS8. I\'m having a problem is that our architecture really wants an NSURL that represents the location of the media on \"disk.\" We use this to upload the media to our servers for further processing. This was easy with ALAsset: ALAssetRepresentation *rep = [asset defaultRepresentation]; self.originalVideo = rep.url; But I\'m just not seeing this ability in PHAsset.

How to get an ALAsset URL from a PHAsset?

若如初见. 提交于 2019-11-26 06:43:45
问题 You can do it sneakily† using the undocumented PHAsset.ALAssetURL property, but I\'m looking for something documented. † In Objective-C, this will help @interface PHAsset (Sneaky) @property (nonatomic, readonly) NSURL *ALAssetURL; @end 回答1: Create the assetURL by leveraging the localidentifier of the PHAsset . Example: PHAsset.localidentifier returns 91B1C271-C617-49CE-A074-E391BA7F843F/L0/001 Now take the 32 first characters to build the assetURL, like: assets-library://asset/asset.JPG?id