[opencms-dev] Reading dimensions of an image
Rüdiger Kurz
r.kurz at alkacon.com
Fri Nov 30 15:40:14 CET 2012
Hi Robert,
by default OpenCms stores the dimension into the property 'image.size'
after uploading a image.
Maybe that will help ...
regards
Rüdiger
On 30.11.2012 15:36, Robert Weber wrote:
> 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
--
Kind Regards,
Rüdiger.
-------------------
Rüdiger Kurz
Alkacon Software GmbH - The OpenCms Experts
http://www.alkacon.com - http://www.opencms.org
More information about the opencms-dev
mailing list