问题
I am using TinyMCE PowerPaste plugin automatically to copy and paste content from Microsoft Word and other HTML sources. I am setting up to true powerpaste_allow_local_images in order to allow local images automatically been upload as Base64 encoded images and it works perfect if I copy and paste from Microsoft Office Suite such as Microsoft Word and outlook. However, if i copy and paste images from other html sources (e.g : Gmail, Google docs, etc), they are not uploaded as base64, instead tinymce creates a reference to the current online location of the image. I always need a base64 encoded images in order to save them in the db, I am wondering how can i force tinymce to create a base64 string for all images are being copied.
Appreciate any suggestion,
回答1:
PowerPaste brings images in from MS Word content because Word places a "local" image in the content (e.g. file:///path/to/image.png
). When PowerPaste sees that local image it grabs an image binary from the RTF flavor in the clipboard - that is why you get a Base64 encoded image when you copy/paste from Word.
If you copy/paste from some online resource (e.g. something open in a browser) there is no "local" image - there is just a proper <img>
tag in the HTML. As there is no image binary anywhere in the clipboard PowerPaste won't create a Base64 encoded image.
In this situation PowerPaste is working exactly as expected.
Please note that if you are a customer who has purchased PowerPaste you can get support from our support team (support.ephox.com).
来源:https://stackoverflow.com/questions/39842533/tinymce-powerpaste-plugin-not-always-creates-base64-string-for-images-when-copyi