iphone 使用 ALAsset 使用 URL 检索图像
我想知道如何使用 URL 检索图像。我正在使用 ALAsset。我从以下链接中找到了答案(带有勾号的答案)显示从 iPhone 中的 ALAsset 检索到的 URL 中的图像。如何检索图像并上传?
I want to know how to how to retrieve a image using URL. I am using the ALAsset. I followed the answer (the one with the tick mark) from the following link display image from URL retrieved from ALAsset in iPhone. How to retrieve the image and upload it?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
您成功获得 ALAsset 了吗?一旦完成,获取图像就很容易了。要获取缩略图,资产有一个方法...thumbnail。
UIImage *img = [UIImage imageWithCGImage:[myAssetthumbnail]];
要获取完整的 Res 图像,您必须使用默认表示形式。
UIImage *img = [UIImage imageWithCGImage:[[myAsset defaultRepresentation] fullResolutionImage]
希望这有帮助
Have you managed to get the ALAsset? Once you do, getting the image is easy. To get a thumbnail, the asset has a method...thumbnail.
UIImage *img = [UIImage imageWithCGImage:[myAsset thumbnail]];
To get the full Res image you have to go through the default representation.
UIImage *img = [UIImage imageWithCGImage:[[myAsset defaultRepresentation] fullResolutionImage]
Hope this helps
我知道这是一个老问题,但为了防止其他人出现,我找到了另一种方法(需要 iOS 5+),该方法返回更容易处理的图像:
来自
fullScreenImage
的文档:< br>在 iOS 5 及更高版本中,此方法返回完全裁剪、旋转和调整的图像 - 与用户在照片或图像选择器中看到的完全一样。
Monkybonk05 的答案确实有效,但它没有被裁剪或旋转。
I know this is an old question but just in case anyone else comes I found another method (requires iOS 5+) that returns an easier to work with image:
From the docs of
fullScreenImage
:In iOS 5 and later, this method returns a fully cropped, rotated, and adjusted image—exactly as a user would see in Photos or in the image picker.
monkybonk05's answer does work, but it not cropped or rotated.
看看这个方法,
我根据这个要点稍微调整了它: https://gist.github.com/ NR4TR/8576048
Check out this method
I've slightly adjusted it based on this gist: https://gist.github.com/NR4TR/8576048