What you are really asking here are two separate questions...
(您在这里真正要问的是两个独立的问题...)
- How do I take Base64 binary images from TinyMCE and store them in an appropriate format?
(如何从TinyMCE中获取Base64二进制映像,并以适当的格式存储它们?)
- What is the best way to include images in an HTML email?
(在HTML电子邮件中包含图像的最佳方法是什么?)
How do I take Base64 binary images from TinyMCE and store them in an appropriate format
(如何从TinyMCE中获取Base64二进制图像并将其以适当的格式存储)
TinyMCE has a built in mechanism to address this via its images_upload_url
configuration option.
(TinyMCE具有内置的机制,可通过其images_upload_url
配置选项解决此问题。)
There is an entire page in the TinyMCE documentation on how this works: (TinyMCE文档中有一整页介绍了其工作原理:)
https://www.tiny.cloud/docs/advanced/handle-async-image-uploads/
(https://www.tiny.cloud/docs/advanced/handle-async-image-uploads/)
The net is that you can have TinyMCE send the image files to an endpoint of your choosing and then convert it to whatever format you need.
(最终,您可以让TinyMCE将图像文件发送到您选择的端点,然后将其转换为所需的任何格式。)
You don't need to keep it as a Base64 binary and it is very rare that you want the Base64 binary as the permanent format. (您不需要将其保留为Base64二进制文件,并且很少希望将Base64二进制文件作为永久格式。)
As for the other question...
(至于另一个问题...)
What is the best way to include images in an HTML email?
(在HTML电子邮件中包含图像的最佳方法是什么?)
This is an incredibly broad topic on its own and there are a great many blog posts on the alternatives for how to include images.
(它本身就是一个令人难以置信的广泛话题,关于如何包含图像的替代方法有很多博客文章。)
This is an article that SendGrid wrote on the subject:
(这是SendGrid在该主题上写的一篇文章:)
https://sendgrid.com/blog/embedding-images-emails-facts/
(https://sendgrid.com/blog/embedding-images-emails-facts/)
As you can see there are multiple options each with pros and cons.
(如您所见,有多个选项各有利弊。)
Which one is right for your use case is not something I can tell you. (我无法告诉您哪种适合您的用例。)
My advice would be to research the alternatives and select the one that works best for your application and the email clients you wish to support. (我的建议是研究替代方案,然后选择最适合您的应用程序和希望支持的电子邮件客户端的方案。)
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…