[opencms-dev] Reading dimensions of an image

Robert Weber rw at clt.ag
Fri Nov 30 15:36:32 CET 2012


Hi List,

I am trying to read the dimensions of an image within VFS, but this code:

CmsResource res = cmso.readResource(pageContext.getAttribute("image").toString());
CmsFile file = new CmsFile(res);
InputStream in = new ByteArrayInputStream(file.getContents());
BufferedImage bimg = ImageIO.read(in);
int width          = bimg.getWidth();


Is not working as I get an NullPointerException. Can anyone help?

Cheers
Robert




More information about the opencms-dev mailing list