将文本格式的 JPEG 从电子邮件源转换回 JPEG

发布于 2024-12-14 19:29:44 字数 1001 浏览 2 评论 0原文

我不久前收到一封电子邮件,其中包含图像附件。从那时起,hotmail 似乎已停止为我托管图像,因为当我打开邮件时,该图像不再可用。

但是,消息源仍然完好无损,如果我没记错的话,消息源(文本形式)也包含图像。

问题当然是它是文本形式的。 (我相信)包含图像的部分看起来像这样:(只是前几行)

<块引用>

--Apple-Mail-2--733971985

内容配置:内联;文件名=photo.JPG 内容 ID: <3F8BDC26-81F3-4BA2-9071-53E78CB3DB63/photo.JPG>

内容类型:image/jpeg; name=photo.JPG 内容传输编码: Base64

/9j/4AAQSkZJRgABAQEASABIAAD/4gxYSUNDX1BST0ZJTEUAAQEAAAxITGlubwIQAABtbnRyUkdC IFhZWiAHzgACAAkABgAxAABhY3NwTVNGVAAAAABJUMgc1JHQgAAAAAAAAAAAAAAAAAA9tYAAQAA AADTLUhQICAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABFj CHJ0AAABUAAAADNkZXNjAAABhAAAAGx3dHB0AAAB8AAAABRia3B0AAACBAAAABRyWFlaAAACGAAA ABRnWFlaAAACLAAAABRiWFlaAAACQAAAABRkbW5kAAACVAAAAHBkbWRkAAACxAAAAIh2dWVkAAAD TAAAAIZ2aWV3AAAD1AAAACRsdW1pAAAD+AAAABRtZWFzAAAEDAAAACR0ZWNoAAAEMAAAAAxyVFJD

它是从我的 iPhone 发送到 Hotmail 的。

这段文字是否代表了我所缺少的图像?我不相信有一个程序可以为我转换这个,所以我愿意编写自己的程序来完成它。问题是,这可能吗?

I received an email a while ago with an image attachment in it. Since then, it seems hotmail has stopped hosting the image for me as when I open the message, the image is no longer available.

However, the message source is still intact, and if I'm not wrong, the message source - in text form - also contains the image.

The problem is of course it is in text form. The part which (I believe) contains the image looks something like this: (Just the first few lines)

--Apple-Mail-2--733971985

Content-Disposition: inline; filename=photo.JPG Content-Id:
<3F8BDC26-81F3-4BA2-9071-53E78CB3DB63/photo.JPG>

Content-Type: image/jpeg; name=photo.JPG Content-Transfer-Encoding:
base64

/9j/4AAQSkZJRgABAQEASABIAAD/4gxYSUNDX1BST0ZJTEUAAQEAAAxITGlubwIQAABtbnRyUkdC
IFhZWiAHzgACAAkABgAxAABhY3NwTVNGVAAAAABJRUMgc1JHQgAAAAAAAAAAAAAAAAAA9tYAAQAA
AADTLUhQICAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABFj
cHJ0AAABUAAAADNkZXNjAAABhAAAAGx3dHB0AAAB8AAAABRia3B0AAACBAAAABRyWFlaAAACGAAA
ABRnWFlaAAACLAAAABRiWFlaAAACQAAAABRkbW5kAAACVAAAAHBkbWRkAAACxAAAAIh2dWVkAAAD
TAAAAIZ2aWV3AAAD1AAAACRsdW1pAAAD+AAAABRtZWFzAAAEDAAAACR0ZWNoAAAEMAAAAAxyVFJD

It was sent from my iPhone into Hotmail.

Is this text representing the image that I am missing? I don't believe there is a program out there that can convert this for me, so I am willing to write my own program to do it. Question is, is this even possible?

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

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

发布评论

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

评论(1

天涯离梦残月幽梦 2024-12-21 19:29:44

是的,通过各种方法,这是完全可能的。如果您有完整的消息源,您可以将其保存到一个文件中(例如 *.eml)并在邮件客户端(例如 Mozilla Thunderbird)中打开它;这应该会显示整个消息,包括附加的图像。

如果没有,它仍然是可能的:正如您从标题中看到的,图像是 Base64 编码的。您需要恢复此转换 - 使用您自己的代码(例如 PHP 有 base64_decode() ),或通过在线提供的各种base64解码器(例如这个)。在本例中,您要解码的部分是以 /9j/4AAQSk 开头的块。将生成的文件重命名为 photo.JPG(如电子邮件标题中所示),然后就完成了。

请注意,这需要您验证是否已将整个 Base64 编码的文件通过解码器 - Base64 没有标记来检测文件结尾。

Yes, this is entirely possible, by various methods. If you have the entire message source, you could save it into a file (something like *.eml) and open it in a mail client (e.g. Mozilla Thunderbird); this should show you the entire message including the attached image.

If not, it's still possible: as you can see from the headers, the image is base64-encoded. You need to revert this transformation - either using your own code (e.g. PHP has base64_decode()), or through various base64-decoders available online (e.g. this). The part you want to decode is the block starting with /9j/4AAQSk in this case. Rename the resulting file photo.JPG (as indicated in the e-mail headers) and you're done.

Note that this requires you to verify that you have put the entire base64-encoded file through the decoder - base64 has no marker to detect the end of file.

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