[英]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.