+ super(inFile, null);
+ }
+
+ /**
+ * Constructor using data, eg from zip file or URL
+ * @param inData data as byte array
+ * @param inName name of file from which it came
+ * @param inUrl url from which it came (or null)
+ */
+ public Photo(byte[] inData, String inName, String inUrl)
+ {
+ super(inData, inName, inUrl);
+ }
+
+ /**
+ * Calculate the size of the image (slow)
+ */
+ private void calculateSize()
+ {
+ ImageIcon icon = null;
+ if (_file != null)
+ icon = new ImageIcon(_file.getAbsolutePath());
+ else
+ icon = new ImageIcon(_data);
+ int width = icon.getIconWidth();
+ int height = icon.getIconHeight();
+ if (width > 0 && height > 0)
+ {
+ _size = new Dimension(width, height);
+ }
+ }
+
+ /**
+ * @return size of image as Dimension object
+ */
+ public Dimension getSize()
+ {
+ if (_size == null) {
+ calculateSize();
+ }
+ return _size;
+ }
+
+ /**
+ * @return width of the image, if known
+ */
+ public int getWidth()
+ {
+ if (getSize() == null) {return -1;}
+ return _size.width;
+ }
+
+ /**
+ * @return height of the image, if known
+ */
+ public int getHeight()
+ {
+ if (getSize() == null) {return -1;}
+ return _size.height;