在我的Java EE应用程序中,有一个上传图片的功能。上传图片时,我将image path保存在MySQL数据库中。
现在我想在我的MySQL database table中使用image path that saved when uploading the image在网页上显示上传的图像。
我怎么能这样做呢?
在将图片转换为bytes[]和Blob之后,我使用java将图像存储到mysql数据库。图像格式是png试图从mysql数据库中检索图像并将其转换为图像文件以保存在本地磁盘上。
将mysql结果集迭代为:
while(rs.next())
{
ByteArrayInputStream bis = new ByteArrayInputStream(rs.getBytes("image"));
Iterator<?> readers = ImageIO.getImageReadersByFormatName("png");
ImageReader re