简体   繁体   English

iPhone:UIImagePickerController如何获取选择器控件的缩略图

[英]iphone: UIImagePickerController how to get the thumbnail for the picker control

Hello I need to use the uiimagepickercontroller to get the photo from the photo library in IOS 3. I managed to get the original image and custom coding to generate the thumbnail from the original image. 您好,我需要使用uiimagepickercontroller从IOS 3中的照片库中获取照片。我设法获取了原始图像,并通过自定义编码从原始图像生成了缩略图。

Is there a way of fetching the thumbnail that was used in the UIImagePickerController? 有没有一种方法来获取UIImagePickerController中使用的缩略图? I can generate thumbnail from original image but it will slow down the whole process. 我可以从原始图像生成缩略图,但是它会减慢整个过程。 At the time, is there a way of saving the url of the original image. 当时,有一种方法可以保存原始图像的网址。 At the moment, I am just create a new image and saved on a temporary folder for later app to upload the server. 目前,我只是创建一个新图像并保存在一个临时文件夹中,供以后的应用程序上载服务器。 The process is too slow since I need to generate thumbnail as well as creating the original image. 由于我需要生成缩略图以及创建原始图像,因此该过程太慢。

in ios 3.0 , their is no direct way to get thumbnail, you have to do custom coding to get thumbnail . 在ios 3.0中,它们不是获取缩略图的直接方法,您必须进行自定义编码才能获取缩略图。 from version 4.0 we have ALAssetsLibrary. 从4.0版开始,我们有了ALAssetsLibrary。

ALAssetsLibrary *assetslibrary = [self defaultAssetsLibrary];

ALAssetsLibraryAssetForURLResultBlock resultblock = ^(ALAsset *myasset){    
              CGImageRef thumbnailRef = [myasset thumbnail]; //gives thumbnail 
        }

[assetslibrary assetForURL:asseturl  resultBlock:resultblock failureBlock:^(NSError *error) {
                                          //handle error
                   }];

but cons of above method is if used declined access to library then you have to handle error and again get thumbnail again with custom coding . 但是上述方法的缺点是如果使用拒绝访问库,则必须处理错误,然后使用自定义编码再次获取缩略图。

please update if you have find any better method . 如果您找到更好的方法,请进行更新。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 iPhone 获取 UIImagePickerController Lat/Lng - iPhone Get UIImagePickerController Lat/Lng 如何使iPhone应用程序使用UIImagePickerController拍摄好照片? - How to get iPhone app to take good pictures using UIImagePickerController? 如何从UIImagePickerController获取缩略图或可保存路径以用于UIImageView? - How do I get a thumbnail or saveable path from UIImagePickerController to use for a UIImageView? 如何在查看iPhone上减小日期选择器控件的大小 - How to Reduce the size of date Picker control on view iPhone 使用UIImagepickercontroller从Iphone照片库获取照片 - Get photos from Iphone photo gallery with UIImagepickercontroller 使用 CAMERA(不是专辑)时从 UIImagePickerController 获取缩略图 - get thumbnail from UIImagePickerController when using CAMERA (not album) iPhone:从没有UIImagePickerController的相机获取图像 - iPhone: get image from camera without UIImagePickerController iPhone:UIImagePickerController-标准缩放控件不起作用 - iPhone: UIImagePickerController - standard zoom control doesn't work 如何使用iPhone库中的UIImagePickerController中的选择按钮 - how to work with choose button in UIImagePickerController in iPhone library iPhone SDK - 如何在UIImagePickerController中禁用图片预览? - iPhone SDK - How to disable the picture preview in UIImagePickerController?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM