photokit

Upload videos from gallery using Photos framework

时光毁灭记忆、已成空白 提交于 2019-12-03 09:44:55
问题 What is the best way to upload videos from gallery using Photos framework? Before I used ALAssetRepresentation and next method: - (NSUInteger)getBytes:(uint8_t *)buffer fromOffset:(long long)offset length:(NSUInteger)length error:(NSError **)error; this allowed to upload file without first copying it to app temp directory. Don’t see any alternatives in Photos framework. Only way seems to use AVAssetExportSession -> export to local directory -> upload, but this requires additional storage

Metadata (EXIF, TIFF, etc.) in Photokit

江枫思渺然 提交于 2019-12-03 04:30:44
问题 In iOS 8, with the new PhotoKit, the way to create a new image is with -[PHPhotoLibrary performChanges:completionHandler] , in this way: [[PHPhotoLibrary sharedPhotoLibrary] performChanges:^{ PHAssetChangeRequest *changeRequest = [PHAssetChangeRequest creationRequestForAssetFromImage:image]; // TODO set metadata? } completionHandler:^(BOOL success, NSError *error) { if(success) { // do stuff } }]; However, I can't find any documentation on how to set metadata on the image. In the old

How to get requested image size for iOS8 PhotoKit?

╄→尐↘猪︶ㄣ 提交于 2019-12-03 02:29:21
I am using the code below for fetching an image: [[PHImageManager defaultManager] requestImageForAsset:asset targetSize:CGSizeMake(800, 600) contentMode:PHImageContentModeAspectFill options:options resultHandler:^(UIImage *result, NSDictionary *info) { NSLog(@"size:%@",NSStringFromCGSize(result.size)); }]; I'm requesting an image size of 800 x 600, but I'm getting an image size of 45 x 60, which is very poor-quality. How can i get the requested image size using PhotoKit ? Your (Unnati's) self answer will work, however it misses out on a number of the optimisations which Apple give you in their

Upload videos from gallery using Photos framework

有些话、适合烂在心里 提交于 2019-12-03 01:20:23
What is the best way to upload videos from gallery using Photos framework? Before I used ALAssetRepresentation and next method: - (NSUInteger)getBytes:(uint8_t *)buffer fromOffset:(long long)offset length:(NSUInteger)length error:(NSError **)error; this allowed to upload file without first copying it to app temp directory. Don’t see any alternatives in Photos framework. Only way seems to use AVAssetExportSession -> export to local directory -> upload, but this requires additional storage space (could be a problem, if video is too big) Seems the only valid way is to request AVAsset from

Metadata (EXIF, TIFF, etc.) in Photokit

别说谁变了你拦得住时间么 提交于 2019-12-02 17:43:37
In iOS 8, with the new PhotoKit, the way to create a new image is with -[PHPhotoLibrary performChanges:completionHandler] , in this way: [[PHPhotoLibrary sharedPhotoLibrary] performChanges:^{ PHAssetChangeRequest *changeRequest = [PHAssetChangeRequest creationRequestForAssetFromImage:image]; // TODO set metadata? } completionHandler:^(BOOL success, NSError *error) { if(success) { // do stuff } }]; However, I can't find any documentation on how to set metadata on the image. In the old ALAssetLibrary (which still works, and may still be the 'correct' way going forward), you would just use -

Delete in PhotoKit: can you skip “Recently Deleted”?

主宰稳场 提交于 2019-12-01 09:02:43
As of iOS8, when you delete a photo, it goes into a trashcan-analog called "Recently Deleted". This happens when you delete via Photos.app, or via the PhotoKit API (using PHAssetChangeRequest.deleteAssets() ). In Photos.app, you can then go into "Recently Deleted", and really delete that photo. Is there a way to do that in PhotoKit? Nope. The only deletion API is deleteAssets . 来源: https://stackoverflow.com/questions/26934777/delete-in-photokit-can-you-skip-recently-deleted

Delete in PhotoKit: can you skip “Recently Deleted”?

感情迁移 提交于 2019-12-01 06:22:24
问题 As of iOS8, when you delete a photo, it goes into a trashcan-analog called "Recently Deleted". This happens when you delete via Photos.app, or via the PhotoKit API (using PHAssetChangeRequest.deleteAssets() ). In Photos.app, you can then go into "Recently Deleted", and really delete that photo. Is there a way to do that in PhotoKit? 回答1: Nope. The only deletion API is deleteAssets . 来源: https://stackoverflow.com/questions/26934777/delete-in-photokit-can-you-skip-recently-deleted

Writing a Photo with Metadata using Photokit

耗尽温柔 提交于 2019-12-01 01:47:06
I am currently using ALAsset framework for saving an image from Photo library to documents directory with metadata. The code I use is ALAssetsLibrary *library = [[[ALAssetsLibrary alloc] init] autorelease]; [library assetForURL:[NSURL URLWithString:miv.assetURL] resultBlock:^(ALAsset *asset) { ALAssetRepresentation *image_representation = [asset defaultRepresentation]; CGImageSourceRef source = Nil; uint8_t *buffer = (Byte*)malloc(image_representation.size); NSUInteger length = [image_representation getBytes:buffer fromOffset: 0.0 length:image_representation.size error:nil]; if (length != 0) {

Writing a Photo with Metadata using Photokit

大城市里の小女人 提交于 2019-11-30 20:54:13
问题 I am currently using ALAsset framework for saving an image from Photo library to documents directory with metadata. The code I use is ALAssetsLibrary *library = [[[ALAssetsLibrary alloc] init] autorelease]; [library assetForURL:[NSURL URLWithString:miv.assetURL] resultBlock:^(ALAsset *asset) { ALAssetRepresentation *image_representation = [asset defaultRepresentation]; CGImageSourceRef source = Nil; uint8_t *buffer = (Byte*)malloc(image_representation.size); NSUInteger length = [image

How to identify if a PHAsset is not completely downloaded from iCloud (so I need to request again with options.networkAccessAllowed)

冷暖自知 提交于 2019-11-30 10:30:07
问题 The docs say: PHImageResultIsInCloudKey: A Boolean value indicating whether the photo asset data is stored on the local device or must be downloaded from iCloud. (NSNumber) If YES, no image was provided, because the asset data must be downloaded from iCloud. To download the data, submit another request, and specify YES for the networkAccessAllowed option. But this key is always YES when a asset is stored in the iCloud Photo Library, even when it is already completely downloaded to the device