Addapted to the chanes in ImageGenerator's read functions (for URL and String parameters)

This commit is contained in:
lehni 2004-07-12 15:19:51 +00:00
parent 61872cfac8
commit 9192cde250

View file

@ -76,12 +76,15 @@ public class ImageObject {
} else if (args[0] instanceof byte[]) { } else if (args[0] instanceof byte[]) {
img = generator.createImage((byte[]) args[0]); img = generator.createImage((byte[]) args[0]);
} else if (args[0] instanceof String) { } else if (args[0] instanceof String) {
String imgurl = args[0].toString(); // the string could either be a url or a local filename, let's try both:
// if path name convert to file: url String str = args[0].toString();
if (imgurl.indexOf(":") < 0) { try {
imgurl = "file:" + imgurl; URL url = new URL(str);
img = generator.createImage(url);
} catch (MalformedURLException e) {
// try the local file now:
img = generator.createImage(str);
} }
img = generator.createImage(imgurl);
} }
} else if (args.length == 2) { } else if (args.length == 2) {
if (args[0] instanceof Number && if (args[0] instanceof Number &&