public instance of images

I have an image in a global media variable.
depending on how it’s been stored, which I cannnot guess afterwards, the JSimage functions require a different object.

When the image is browsed or dropped in the field, direct operation on the varaible are OK. ie:
globals.jpg_image.rotate(90) works…

When the image is got using
plugins.http.getMediaData(urlpath)
I need to load it in a variable with plugins.images.getImage first, then use that variable to rotate the image.
var $image = plugins.images.getImage(jpg_image) ;
jpg_image = $image.rotate($angle);
and that works only once…

where is the devil?

forget the “that works only once”.

found what was wrong: one can’t store
globals.x = plugins.http.getMediaData(url)
directly into a global field, it works only once…

instead one must use:
var $image = plugins.http.getMediaData(url) ;
globals.x = plugins.images.getImage($image);