title: Get the file size of an image loaded into the image component in cq5?
body: <p>I'm working on a cq5 project and I need to restrict the file the size of images uploaded via the image component to about a 150kb. I have created a custom image component called "<code>customimage</code>" by copy, pasting and renaming the default image component.</p>
  
  <p>The property "<code>fileReference</code>" returns the relative path of the file <code>(for instance "/content/dam/myProject/emea/logo.jpg")</code>. There is no property for the absolute path. Right now I have code written to check the size of the file in the customimage.jsp file I have some code that looks like </p>
  
  <pre><code>String path = (String)properties.get("fileReference","");
  
  File file = new File(path);
  
  double file_size = file.length();
  </code></pre>
  
  <p>Problem is that no mater what image I pass into the component, file_size returns 0.0. The project is in html 4 so I can't take advantage of the nifty javascript file I/O that <code>html5</code> added so it has to be done through the java. What am I doing wrong? Is there another way I should be approaching this problem in cq5?</p>