save "media:///picture.jpg" into a file

I would like to be able to save a picture, stored in the media database, into a file. Does anyone know of a way to do that other than:

elements.name.setImageURL("media:///picture.jpg")
var rData = elements.name.getThumbnailJPGImage()
application.writeFile("picture.jpg", rData)

This code makes me create/use an element that I then have to make invisible and give it a size big enough to show the image at 100% (since that is what I need)…

Who can help?

Thanks

Try this:

var image = plugins.http.getMediaData(“media:///picture.jpg”);
application.writeFile(‘picture.jpg’, image);

It created a jpg file in my servoy folder. Hope this helps.

Adam

Thanks, for now I get a Java out of memory message but I will retry tomorrow…

This is help me for my splash plugin!!!