Hi,
Been strugling with this for a while now, cannot find a way to do it…
I’m trying to pass an image from the Servoy Media library into a plugin. So far no succes.
I think on the Servoy side I would have to do something like:
plugins.PBS_Tools.insertImage(plugins.http.getMediaData(“media:///image.gif”))
But on the plugin side, how do I retrieve it again? This is what I have now, but this in combination with the way I call the function in Servoy doesn’t work…:
public void js_insertImage (Image image)
{
bladibladibla;
}
Any help appreciated..
Paul
In the plugin java code you can open an inputstream from an URL
like:
InputStream is = new URL(“media:///image.gif”).openStream();
from the stream you can read the bytes. (do not forget to close the steam!)
Jan,
Tnx for the pointer. Didn’t get that up and running, but looking at it from that angle, I found the following that works:
String name2 = “media:///” + name;
URL url = new URL(name2);
Image image = ImageIO.read(url);
In the sample above, name is a string that the function needs as parameter.
Is this a good way to achieve the same? As far as I understand it, there’s nothing I have to close now, right?
Paul