Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有 java.awt.Image img,并想将其作为 HTML 标记添加到 myjTextEditor,这是通过 img src=.... 嵌入图像的已知方法,但没有用:
String Html="<img src=\""+thumb+"\"/><br/>";// thumb is an Image Object myjTextEditor.setText(Html);
如果拇指是文件,该代码将正常工作......可以这样做吗?(即嵌入图像对象)??
好吧,如果您可以对拇指数据进行 base64 编码,则可以这样使用:
<img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUA AAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO 9TXL0Y4OHwAAAABJRU5ErkJggg==" alt="Red dot" />
image/png;base64 之后的部分是 base64 编码的二进制图像数据。