Dropzone HEIC 图像上传为 JPG 时无法保存

发布于 2025-01-13 01:09:10 字数 689 浏览 5 评论 0原文

我正在使用 Dropzone 进行图像上传。如果上传 HEIC 图像,我使用 heic2any 使用以下代码转换文件: https://github.com/dropzone/dropzone/issues/1984#issuecomment-886460171。我检查file.type,如果它是image/heic,我就会进行转换。它非常适合我笔记本电脑上的 HEIC 图像,即上传的图像被识别为 HEIC 图像并成功转换和保存。

问题是从 iPhone 上传 HEIC 图像。当收到图像时,它是一个image/jpeg,因此我不使用heic2any 对其进行转换。看来如果上传的 HEIC 图像很小,无需 heic2any 即可成功转换为 JPEG。但是,以 JPG 形式接收的较大 HEIC 图像无法成功保存。如果从笔记本电脑上传较大的 HEIC 图像,它确实可以工作,因为它被识别为 image/heic 并命中 heic2any 代码。

对于如何处理从 iPhone 上传的较大 HEIC 图像有什么建议吗?这些图像以某种方式转换并以 JPEG 形式接收,没有经过 heic2any 但没有保存?

I'm using Dropzone for image uploads. If a HEIC image is uploaded I use heic2any to convert the file using this bit of code: https://github.com/dropzone/dropzone/issues/1984#issuecomment-886460171. I check the file.type and if it is an image/heic I do the conversion. It works great for a HEIC image on my laptop namely the uploaded image is recognized as a HEIC image and is successfully converted and saved.

The issue is uploading a HEIC image from the iPhone. When the image is received, it is a image/jpeg and therefore I don't convert it with heic2any. It seems if the uploaded HEIC image is small, it gets converted to a JPEG successfully without heic2any. However, larger HEIC images that are received as a JPG aren't successfully saved. If the larger HEIC image is uploaded from the laptop it does work since it's recognized as a image/heic and hits the heic2any code.

Any suggestions for how to handle larger HEIC images uploaded from a iPhone that are somehow converted and received as a JPEG having not gone through heic2any but are not saving?

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

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

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文