phasset

How to get photo from My Photo Stream Album

女生的网名这么多〃 提交于 2019-12-31 07:19:08
问题 I want to get Photo from My Photo Stream. I have only localIdentifier of PHAsset. For photos other than My Photo Stream album I am using below code for retrieve PHAsset. [PHAsset fetchAssetsWithLocalIdentifiers:@[“localIdentifier”] options:nil].firstObject localIdentifier is like ' 1BFC3BA2-AC95-403A-B4FF-B26AFB631581/L0/001 ' it's working fine. But in my My Photo Stream album I am getting nil value of PHAsset. Does anyone having a idea how we can get original Photo from My Photo Stream using

How to access NSData/NSURL of slow motion videos using PhotoKit

感情迁移 提交于 2019-12-29 04:52:08
问题 Working with new Photo framework, I can access the NSData of PHAssets using requestImageDataForAsset . I can also access the file URL using the PHImageFileURLKey of the returned info NSDictionary . [[PHImageManager defaultManager] requestImageDataForAsset:asset options:nil resultHandler:^(NSData *imageData, NSString *dataUTI, UIImageOrientation orientation, NSDictionary *info) { //imageData contains the correct data for images and videos NSLog(@"info - %@", info); NSURL* fileURL = [info

How to handle multiple images with large size?

痴心易碎 提交于 2019-12-25 06:32:04
问题 I have list of selected images from Photos gallery. The array list contain selected PHAssets from Photos <PHAsset: 0x131334350> 768AD8BA-FE7A-4EE9-B2CF-4DD4AEBE2AE9/L0/001 mediaType=1/0, sourceType=1, (2448x3264), creationDate=2016-03-11 06:50:09 +0000, location=1, hidden=0, favorite=0 ", "<PHAsset: 0x131334260> CA962E42-A367-4E8D-85C8-934F8C76FE78/L0/001 mediaType=1/0, sourceType=1, (2448x3264), creationDate=2016-03-11 06:50:08 +0000, location=1, hidden=0, favorite=0 " Now i want to store

SDWebImage with PHAssets

一笑奈何 提交于 2019-12-25 04:49:35
问题 i have an application where i am loading large amount of images from database and showing them in my gallery, what i was doing earlier is i was getting photo url (local identifier) from PHAsset and then accessing the image using PHCacheManager, but it slows down my scrolling and also shows lags while updating images in new cell. I was trying to use SDWebImage here by passing the url to the sd_setImageWithURL: method, however i found out that the URL is actually a local identifier which is not

How to get latitude and longitude of an image using PHAsset in iOS?

家住魔仙堡 提交于 2019-12-24 08:48:47
问题 I am trying to fetch images from photo library within the range of two dates and I am getting the images successfully. And I am also getting the info of the image by using below code. PHContentEditingInputRequestOptions *options = [[PHContentEditingInputRequestOptions alloc] init]; options.networkAccessAllowed = YES; //download asset metadata from iCloud if needed [asset requestContentEditingInputWithOptions:options completionHandler:^(PHContentEditingInput *contentEditingInput, NSDictionary

How to detect if video is Landscape/portrait when fetched from PHAsset?

空扰寡人 提交于 2019-12-24 00:56:31
问题 I am fetching videos from PHAsset so user can choose the video and import to perform edit. But user should be only able to select video with Landscape orientation, if user select portrait video, she/he would get alert message saying that its portrait video and hence can not import to edit. One way to do this is creating AVAsset from URL of PHFetchResults, and then checking a preferedTransform, but that would be very costly operation to do right? Is there a way to do this without creating

PHFetchResults date filter not generating correct results for time range

落花浮王杯 提交于 2019-12-24 00:44:27
问题 I am trying to fetch images from photo library within the range of two dates and I am getting the images successfully. Using PHAsset Library Now the problem is that am not able to get images between two times of the same day like between 12:10PM to 12:30PM Using below code NSDate *startDate = [self getDateForDay:30 andMonth:9 andYear:2016 andHour:12 andMinute:10 andSecond:0]; NSDate *endDate = [self getDateForDay:30 andMonth:9 andYear:2016 andHour:12 andMinute:30 andSecond:0]; -- -(NSDate*)

Upload PHAsset from iCloud (i.e. which is not present on the local device )

此生再无相见时 提交于 2019-12-23 04:55:12
问题 I want to upload a PHAsset to the server. Now my PHAsset can be a photo or a video. I am able to do it successfully for the PHAssets present on the local device. But what if the PHAsset is not on the local device and instead present on the iCloud. Can we upload directly from the iCloud to the server or do we have to first download to the local device and then to upload operation to the server. Also, I would be grateful if someone could tell how to do this. Update: when we allow the network

Saving photo with metadata into Camera Roll with specific file name

怎甘沉沦 提交于 2019-12-22 06:41:12
问题 I'm trying to save an image with exif metadata using following code: +(void)saveImageWithMetaToCameraRoll:(UIImage*)image location:(CLLocation*)location album:(PHAssetCollection *)album exif:(NSDictionary *)metadata isOriginal:(BOOL)isOriginal isFavorite:(BOOL)isFavorite completionBlock:(PHAssetBoolBlock)completionBlock { NSMutableDictionary *meta = [metadata mutableCopy]; NSData *imageData = UIImageJPEGRepresentation(image, 1.0f); CGImageSourceRef source = CGImageSourceCreateWithData((_

PHAsset get original file name

醉酒当歌 提交于 2019-12-20 09:18:46
问题 I wonder if there any way to get the original file name using PHAsset? I use the following code to extract the file info. [[PHImageManager defaultManager] requestImageDataForAsset:asset options:requestOption resultHandler:^(NSData *imageData, NSString *dataUTI, UIImageOrientation orientation, NSDictionary *info) { entity.fileUrl = [info objectForKey:@"PHImageFileURLKey"]; entity.filename = [[NSFileManager defaultManager] displayNameAtPath:[ entity.fileUrl path]]; }]; However, It doesn't