I list some persons and I would like to post the photo. In the database, that's the path to the photo which is copied in a field of my DataSet (row["Photo"]). This path is well copied and I show the photo.
But, sometimes, the field photo in the DataBase is empty. Then I would like to not load the image when this field is empty (or row["Photo"]).
How can I do that please ?
When I load an empty image, I have this message : GRAVE: can't retrieve image intrinsic dimension! 3 juil. 2006 11:43:17 org.eclipse.birt.report.engine.emitter.pdf.PDFEmitter drawImage ATTENTION: C:\jakarta-tomcat-4.1.31\bin\row["Photo"] (Syntaxe du nom de fichier, de répertoire ou de volume incorrecte) java.io.FileNotFoundException: C:\jakarta-tomcat-4.1.31\bin\row["Photo"] (Syntaxe du nom de fichier, de répertoire ou de volume incorrecte) at java.io.FileInputStream.open(Native Method) at java.io.FileInputStream.<init>(FileInputStream.java:106) at java.io.FileInputStream.<init>(FileInputStream.java:66) [...] at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:6 83) at java.lang.Thread.run(Thread.java:534)
String imagePath = ... //read from DB or wherever you get the information from
if (imagePath != null) {
java.io.File imageFile = new java.io.File(imagePath);
if (imageFile.exists() && !imageFile.isDirectory()) {
//load your image here
}
}