Alexander Lohse schrieb:
As I am coming from PHP I am used to a very quick function-call to find
the size of an image. In Java I have to read the whole image into
memory, which takes very long in terms of request-time.
You don't have to read the entire image. The dimensions are usually
embedded in some meta-data section, so it is not necessary to decode the
entire image just to get the dimensions.
This is how you get the dimensions from image files:
ImageInputStream i = ImageIO.createImageInputStream(new
FileInputStream(file));
try {
Iterator<ImageReader> r = ImageIO.getImageReaders(i);
if (r.hasNext()) {
ImageReader reader = r.next();
reader.setInput(i, true);
width = reader.getWidth(0);
height = reader.getHeight(0);
formatName = reader.getFormatName().toLowerCase();
reader.dispose();
}
} finally {
i.close();
}
HTH,
Timo
-------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user