![](http://content.invisioncic.com/i328763/set_resources_3/84c1e40ea0e759e3f1505eb1788ddf3c_pattern.png)
escultor
-
Posts
2 -
Joined
-
Last visited
Content Type
Forum
Downloads
Featured Visualizations
Knowledge Base
Documentation (PDF Downloads)
Blog
Documentation (Test Area)
Documentation
Dr. Jaspersoft Webinar Series
Security Advisories
Events
Profiles
Posts posted by escultor
-
-
i found a way to do this, but is not working at all, still working on it:
These are the step :
Create a Class with the next code :
import java.io.File;
import java.io.FileOutputStream;
import java.util.logging.Logger;
public class Images {
private static final Logger log = Logger.getLogger("Images");
public Images() {
}
public File convertBytes(java.io.InputStream objeto) {
try {
java.io.ByteArrayInputStream bais = (java.io.ByteArrayInputStream) objeto;
String strBais = bais.toString();
File file = new File("Foto.jpg");
FileOutputStream fos = new FileOutputStream(file);
int data;
while ((data = bais.read()) != -1) {
char ch = (char) data;
fos.write(ch);
}
fos.flush();
fos.close();
return file;
} catch (Exception e) {
e.printStackTrace();
}
return null;
}2.- Add the image and Change the "Expression clase to java.io.File"
3.- In the "Image Expression" add new class.package.Image().convertBytes($F{FieldFromDatabase})
4.- Add the jar if needed and dont forget to add the imports on your properties report.
5.- Sometime is necesary to change the rigths where the image wil be allocated.
postgresql bytea image problem
in Products
Posted
i found a way to do this, but is not working at all, still working on it:
These are the step :
Create a Class with the next code :
import java.io.File;
import java.io.FileOutputStream;
import java.util.logging.Logger;
public class Images {
private static final Logger log = Logger.getLogger("Images");
public Images() {
}
public File convertBytes(java.io.InputStream objeto) {
try {
java.io.ByteArrayInputStream bais = (java.io.ByteArrayInputStream) objeto;
String strBais = bais.toString();
File file = new File("Foto.jpg");
FileOutputStream fos = new FileOutputStream(file);
int data;
while ((data = bais.read()) != -1) {
char ch = (char) data;
fos.write(ch);
}
fos.flush();
fos.close();
return file;
} catch (Exception e) {
e.printStackTrace();
}
return null;
}
2.- Add the image and Change the "Expression clase to java.io.File"
3.- In the "Image Expression" add new class.package.Image().convertBytes($F{FieldFromDatabase})
4.- Add the jar if needed and dont forget to add the imports on your properties report.
5.- Sometime is necesary to change the rigths where the image wil be allocated.