Tag: alassetslibrary

MonoTouch:从ALAssetsLibrary.AssetForUrl中获取图像

在MonoTouch中: 我将相机中的图像放入PhotoAlbum中: ALAssetsLibrary library = new ALAssetsLibrary(); library.WriteImageToSavedPhotosAlbum(photo.CGImage, meta, (assetUrl, error) => { library.AssetForUrl(assetUrl, GotAsset, FailedGotAsset); }); Photo在那里,运作良好。 在代表GotAsset我试图摆脱图像,但只有缩略图在那里。 图像在哪里? void GotAsset(ALAsset asset) { //asset has only thumbnail info??? } 以下是资产的外观:

拍照后select“使用照片”时,使用UIImagePickerController的应用程序会冻结

我正在制作一个简单的照片和video捕捉应用程序。 该应用程序成功地允许用户按下button拍摄照片或video。 但是,只要您完成拍摄照片或video,就会有2个选项:“重拍”和“使用照片”或“使用video”,具体取决于您使用的是哪一种。 如果用户点击“重拍”,那么就让他们重拍一张新的照片或video,但是当用户点击“使用照片”或“使用video”时,屏幕会冻结。 如果我退出冻结的应用程序,并看看我的相机胶卷,我刚刚使用该应用程序的照片已成功保存。 所以,当你点击“使用照片”button,即使应用程序屏幕冻结,它也能成功保存到相机上。 有人告诉我,“冻结是因为保存照片需要一些时间,而且它正在主线程上运行,你可以使用ALAssetLibrary来解决冻结问题。” 但是,我不熟悉ALAssetLibrary或者为什么在这种情况下会有帮助的理论。 我只是通过它的一些文档浏览,而我仍然迷失。 任何帮助将不胜感激。 这是我迄今为止的代码: ViewController.h: #import <UIKit/UIKit.h> @interface ViewController : UIViewController <UINavigationControllerDelegate, UIImagePickerControllerDelegate> @property UIImagePickerController * pickerController; -(IBAction)showCameraUI; @end ViewController.m: #import "ViewController.h" #import <MobileCoreServices/MobileCoreServices.h> @interface ViewController () <UINavigationControllerDelegate, UIImagePickerControllerDelegate> //The above are the 2 delegates required for creating a media capture/camera app. – (void)imagePickerController:pickerController didFinishPickingMediaWithInfo:(NSDictionary *)info; @end @implementation […]

ALAssetsLibrary图像扭曲

我正在使用下面的代码从相机胶卷加载图像。 但是当图像显示在图像视图中时,图像有时会向左旋转90度。 我怎样才能纠正这一点? 谢谢! ALAssetsLibraryAssetForURLResultBlock resultblock = ^(ALAsset *myasset) { ALAssetRepresentation *rep = [myasset defaultRepresentation]; CGImageRef iref = [rep fullResolutionImage]; if (iref) { cell.image.image = [UIImage imageWithCGImage:iref]; } }; ALAssetsLibraryAccessFailureBlock failureblock = ^(NSError *myerror) { NSLog(@"Can't get image – %@",[myerror localizedDescription]); }; NSString *urlString = [[_alleArtikel objectAtIndex:indexPath.row] bildURL]; NSURL *asseturl = [NSURL URLWithString:urlString]; ALAssetsLibrary* assetslibrary […]

从自定义相册中删除图像PHPhotoLibrary目标C

在我的应用程序中,我使用编辑图片并保存在名为“Fab”的库中的自定义文件夹中。 现在有什么东西从文件夹中删除该图像? 我find了不同的解决scheme,但他们需要资产的URL。 我使用的照片框架,以便如何获取特定图像的资产url删除?

将资产库中的图像复制到应用文件夹

我有一个UIImagePickerController,我想将选定的图像保存到我的应用程序。 我可以通过获取当前UIImage并保存(通过创build文件)来实现这一点,但是我更愿意直接将文件从Library复制到我的文件夹中。 所以现在我有一个选定的图像的URL:UIImagePickerControllerReferenceURL返回一个特定的模式“assets-library”。 我试图从这种URL复制一个图像到一个path,但没有成功。 有什么我想要做的成功的方法? 谢谢 !

打开相机卷在一张确切的照片

我正在开发一个相机应用程序,我想把一些已经存在于股票应用程序中的function。 我的问题是复制在左下angular(肖像模式),用户刚刚拍摄的照片的微缩略图显示的小方块; 然后,当用户点击它时,照片应用程序应打开,保存在相机胶卷上的最后一张照片。 我可以使用ALAssetsLibrary加载相机胶卷中最新照片的缩略图 – 我可以使用[UIImage imageWithCGImage:[result thumbnail]]访问它 – 但即使我有它的ALAsset URL,我也无法打开照片应用程序。 我正在努力做到这一点: [[UIApplication sharedApplication] openURL:result.defaultRepresentation.url]; 但没有任何反应。 我可以在内部显示它在我的应用程序,与一个额外的UIView,但我认为会更简单,…更聪明的使用官方照片应用程序! 谁能帮我? 先谢谢你!

在iPhone中获取图片库中的所有图像

我试图从照片库中检索图像,并使用AssetsLibrary在我的应用程序中显示。 我得到了照片的URLpath,但我不知道如何通过它的照片。 我的代码如下: NSMutableArray* assetURLDictionaries = [[NSMutableArray alloc] init]; void (^assetEnumerator)( ALAsset *, NSUInteger, BOOL *) = ^(ALAsset *result, NSUInteger index, BOOL *stop) { if(result != nil) { if([[result valueForProperty:ALAssetPropertyType] isEqualToString:ALAssetTypePhoto]) { [assetURLDictionaries addObject:[result valueForProperty:ALAssetPropertyURLs]]; NSLog(@"result is:%@",result); NSLog(@"asset URLDictionary is:%@",assetURLDictionaries); NSURL *url= (NSURL*) [[result defaultRepresentation]url]; [library assetForURL:url resultBlock:^(ALAsset *asset) { [assetsp addObject:asset]; } failureBlock:^(NSError *error){ […]

使用ALAssetsLibrary从iphone相册中读取图像

我正在尝试编写一个方法来读取相册中的资源我使用ALAsset从所有相册中获取所有图像,我的问题是如何自定义此方法以从myAlbum读取图像 /** * This method is used to get all images from myAlbum * folder in device if getAlbumImages is set to 1 * else loads all images from devices library */ -(void)readImages:(int)getAlbumImages { imageArray = [[NSArray alloc] init]; mutableArray =[[NSMutableArray alloc]init]; NSMutableArray* assetURLDictionaries = [[NSMutableArray alloc] init]; library = [[ALAssetsLibrary alloc] init]; if(getFolderImages == […]

如何将资源库中的图像移动到应用程序特定的私有位置?

这是我试过的代码片段: [library writeImageToSavedPhotosAlbum:self.checkInImage.CGImage metadata:self.metadata completionBlock :^(NSURL * assetURL, NSError * error) { NSLog (@"Asset url = %@", assetURL); NSError *err; NSString *docDir = [NSSearchPathForDirectoriesInDomains (NSDocumentDirectory, NSUserDomainMask, YES) objectAtIndex:0]; NSString *jpgFilePath = [NSString stringWithFormat:@"%@/test.jpg", docDir]; NSFileManager *fileManager = [NSFileManager defaultManager]; [fileManager moveItemAtURL:assetURL toURL:[NSURL URLWithString:jpgFilePath] error:&err]; NSLog(@"error is %@", err); }]; 我得到错误为错误域= NSCocoaErrorDomain代码= 262“该操作无法完成。(Cocoa错误262.)”UserInfo = 0xb49a680 {NSURL […]

iOS在UITableView中显示来自ALAsset的图像

我有一个数据库存储项目。 这些项目可以是不同types的文字,video和图像types。 当视图加载时,我从数据库中获取这些项目,并在UITableView中显示它们。 我面临的问题是在表格视图中显示图像。 基本上在数据库我存储的ALAsset链接相关的图片,并从它我试图得到它的形象使用此代码: – (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{ //…Other Code else if ([object isMemberOfClass:[Picture class]]){ //Get a reusable cell cell = [tableView dequeueReusableCellWithIdentifier:@"pictureCellIdentifier"]; // [self performSelectorInBackground:@selector(performAsset:) withObject:dict]; ALAssetsLibraryAssetForURLResultBlock resultblock = ^(ALAsset *myasset) { ALAssetRepresentation *rep = [myasset defaultRepresentation]; CGImageRef iref = [rep fullResolutionImage]; if (iref) { ((PictureViewCell *)cell).placeHolderImageView.hidden = YES; ((PictureViewCell *)cell).pictureImageView.image […]