Hello friends could help me in a problem that I have, what I want is to get an image that is stored in a folder that is on a server that I am but which I have access to once I get this image for it in my report with ireport but, this image is saved according to some parameters for example are images that contain a person's signature and its parameters ie the name the image is saved according to (id, nrofirma) that is to say in summary once it enters the folder has to look for the image by its name according to the parameters that are sent ...
I have managed to obtain the route of the image, also the image but I do not know what I need to pass it to my report
in this code is how I pass some values as you can see pass an image that is in my project that if it happens normal
Map parametro = new HashMap();
parametro.put("codalmacen", codalmacen);
parametro.put("codsubalmacen", codsubalmacen);
parametro.put("tipoguia", tipoguia);
parametro.put("emiguia", emiguia);
parametro.put("nroguia", nroguia);
parametro.put("usuariocrea", dataAsig[0][0]);
parametro.put("usuarioautoriza", usuarioautoriza);
parametro.put("usuarioatiende", Logueo.id_personal);
parametro.put("usuarioasignado", usuariocrea);
parametro.put("SUBREPORT_CONNECTION", cnp.getConnection());
parametro.put("SUBREPORT_CONNECTION_PL", cna.getConnection());
parametro.put("SUBREPORT_DIR", "" + getClass().getClassLoader().getResource("m_reportes/"));
parametro.put("firma",getClass().getClassLoader().getResourceAsStream(ruta + "FirmasPersonal/"+sfirma+"/" + sfirma+numerodefirma+".png"));
parametro.put("logo2", getClass().getClassLoader().getResourceAsStream("m_imagen/logo.gif"));
this is the code where I get the route and the image
String snrofirma = "SELECT s_firma, n_firma, tf.id_personal as codigo,"
+ " per.ap_paterno ||' '|| per.ap_materno ||' '||per.pr_nombre ||' '|| case when per.sg_nombre is null then '' else per.sg_nombre end as personal"
+ " , tf.id_estado, te.nom_estado as estado"
+ " FROM tab_personal_firma tf"
+ " left outer join tab_personal per on per.id_personal=tf.id_personal"
+ " left outer join tab_estado te on te.id_tabla='0046' and te.id_estado=tf.id_estado"
+ " left outer join tab_sede ts on ts.id_sede=tf.id_sede_crea"
+ " where tf.id_personal='"+usuariocrea+"'";
String numerodefirma = "";
String sfirma = "";
ResultSet rs15 =cnp1.executeQuery(snrofirma);
while(rs15.next()){
sfirma=rs15.getString("s_firma");
numerodefirma=rs15.getString("n_firma");
}
if ( numerodefirma =="") {
JOptionPane.showMessageDialog(this, "<html> <font size=4><b>El personal no tiene Firma</b></font>", this.getTitle(), JOptionPane.OK_OPTION);
}
System.out.println(numerodefirma);
System.out.println(sfirma);
String conexioncarpeta = "SELECT path,usuario,clave,servidor FROM tab_ruta where tipo=5 and estado=0";
try {
ResultSet rs = cnp1.executeQuery(conexioncarpeta);
while (rs.next()) {
ruta = rs.getString("path");
smbuser = rs.getString("usuario");
smbclave = rs.getString("clave");
servidor = rs.getString("servidor");
}
rs.close();
} catch (SQLException ex) {
System.out.println(ex);
}
try {
SmbFunction smb = new SmbFunction();
smb.login(servidor, smbuser, smbclave);
String archivo = sfirma + numerodefirma + ".png";
String pathcargo= ruta + "FirmasPersonal/"+sfirma+"/" + archivo;
ImageIcon imagenfirma = new ImageIcon(smb.getBufferedImage(pathcargo));
} catch (Exception ex) {
Logger.getLogger(Control_Requerimiento_Atender.class.getName()).log(Level.SEVERE, null, ex);
}