我试图使用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);
感谢。
答案 0 :(得分:1)
图像/图片如何保存到数据库中?你正在使用另一个脚本吗?或者你手动保存它?我建议你应该为path
或location
专门设置另一个专栏,以便将来可以参考。每当您上传/保存照片时,请在该列中包含您需要的信息。
此answer也可以为您提供帮助。