I want to retrieve image from mysql database using servlet and show that image along with that user details in table

前端 未结 1 1395
小鲜肉
小鲜肉 2021-01-26 14:48

Everything is working well. When I delete Code for Retrieving image then I get user details in table and when I put the code to retrieve image along with the code of printing us

相关标签:
1条回答
  • 2021-01-26 15:33

    You could Base64-encode your image data and use the data URI in the src attribute of an img tag, e.g. <img src="data:image/png;base64,iVBORw0KGgoAAAANS... (the Base64 encoded image data) ...8bgAAAAASUVORK5CYII=”>.

    Few notes:

    • It is not supported in old IE versions (older than IE8, and the size of data is limited in IE8);
    • I don't think it is a good idea to embed the dynamic images this way, proper way would be to have a separate servlet just to serve the images, and use a normal URI in the src attribute. See the Important Notes part in the above linked page.
    0 讨论(0)
提交回复
热议问题