iPhone 应用程序可以为通过相机或照片库获取的图像生成缩略图

发布于 2024-10-10 13:38:58 字数 277 浏览 0 评论 0原文

我的应用程序允许用户从相机/照片库获取图片/图像,然后应用程序会将图像上传到远程存储。由于在某些场景中会使用这些图像的缩略图,因此我需要生成缩略图。

问题是

  1. 应用程序是否应该在获取原始/原始图像时生成缩略图?

  2. 同时将原始图像及其至少 2 个缩略图从应用程序上传到远程存储 - 假设其 Amazon S3 或 Google App Engine

  3. 是否有任何示例代码可以在 iPhone 上进行图像转换?

My app allows user to obtain picture/image from camera/photo gallery and then the app will upload the images to remote storage. Since the thumbnail images of those images will be used in some scenarios, I need to generate the thumbnail images.

The questions are

  1. should the thumbnail images be generated by the app at the time when the original/raw image is obtained?

  2. is it achievable to upload a raw image and at least 2 of its thumbnail images at the same time from the app to the remote storage - let's say its Amazon S3 or Google App Engine

  3. is there any sample code out there that does the image transformation on iPhone?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

梦毁影碎の 2024-10-17 13:38:59
  1. 我认为您应该在顶部放置一个进度指示器,告诉您的用户“请稍等,我正在生成缩略图”。
  2. 我认为同时不适合您。相反,您应该尝试以串行方式上传它们(2 个缩略图和 1 个原始图像)。也就是说,“尝试第一个缩略图,如果成功,请尝试第二个缩略图...”,因为 iPhone 等移动设备的互联网连接可能不稳定。请求超时确实会发生,因此最好在开始下一个请求之前始终确保已完成上一个请求。
  3. 我认为 Three20 的 TTThumbsViewController(或 TTPhotoViewController)在将原始照片转换为方形缩略图方面做得很好。也许你应该看看他们的源代码。

顺便说一句,至于将照片上传到服务器,我曾经使用 ASIFormDataRequest 将我的照片发布到服务器。效果很好。

希望有帮助。 :-)

  1. I think you should, and put a progress indicator on top to tell your user that "please wait, I'm generating thumbnails".
  2. I don't think at the same time is appropriate for you. Instead, you should try to upload them (2 thumbnails and 1 raw) in a serial manner. That is, "try 1st thumbnail, if succeed, try 2nd thumbnail...",since the internet connection for a mobile device like iPhone could be unstable. Requests-timing-out does happen, therefore it's better to always make sure you have finished the previous request before you start the next one.
  3. I think three20's TTThumbsViewController (or TTPhotoViewController) has done a good job in transforming original photos into square-shaped thumbnails. Maybe you should take a look at their source code.

btw, as for uploading photos to servers, I once used the ASIFormDataRequest to post my photos to a server. It worked pretty well.

Hope it helps. :-)

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文