如何创建从数据库中获取的图片的路径并保存文件夹?

时间:2016-01-18 07:15:22

标签: java image postgresql inputstream imageicon

我试图使用java从postgresql中的数据库中获取图像,我想知道如何为该图像创建命名路径(例如C:/images/pic.png),这是怎么回事我从数据库中获取图像。

InputStream is;
ImageIcon foto;
is =  results.getBinaryStream(i+1);
BufferedImage bi = ImageIO.read(is);
foto = new ImageIcon(bi);
Image img = foto.getImage();
Image newimg = img.getScaledInstance(140, 170, java.awt.Image.SCALE_SMOOTH);
ImageIcon newicon = new ImageIcon(newimg);

感谢。

1 个答案:

答案 0 :(得分:1)

图像/图片如何保存到数据库中?你正在使用另一个脚本吗?或者你手动保存它?我建议你应该为pathlocation专门设置另一个专栏,以便将来可以参考。每当您上传/保存照片时,请在该列中包含您需要的信息。

answer也可以为您提供帮助。