diff --git a/src/helma/scripting/rhino/extensions/ImageObject.java b/src/helma/scripting/rhino/extensions/ImageObject.java index 696ae60d..d9bb53cd 100644 --- a/src/helma/scripting/rhino/extensions/ImageObject.java +++ b/src/helma/scripting/rhino/extensions/ImageObject.java @@ -121,7 +121,7 @@ public class ImageObject { public Object call(Context cx, Scriptable scope, Scriptable thisObj, Object[] args) { if (args.length != 1) { - throw new IllegalArgumentException("Image.getImageInfo() expects one argument"); + throw new IllegalArgumentException("Image.getInfo() expects one argument"); } Object arg = args[0]; @@ -142,6 +142,18 @@ public class ImageObject { } catch (FileNotFoundException fnf) { return null; } + } else if (arg instanceof File) { + try { + in = new FileInputStream((File) arg); + } catch (FileNotFoundException fnf) { + return null; + } + } else if (arg instanceof FileObject) { + try { + in = new FileInputStream(((FileObject)arg).getFile()); + } catch (FileNotFoundException fnf) { + return null; + } } else if (arg instanceof String) { String str = (String) arg; // try to interpret argument as URL if it contains a colon, @@ -165,7 +177,7 @@ public class ImageObject { } if (in == null) { - String msg = "Unrecognized argument in Image.getImageInfo(): "; + String msg = "Unrecognized argument in Image.getInfo(): "; msg += arg == null ? "null" : arg.getClass().toString(); throw new IllegalArgumentException(msg); }