I saw similar post about my problem but they only display width and height. But I have to return these variables to use them later.
here is my code, I get always "0" ;
var img = new Image();
img.src = "my_image.jpg";
newWidth = 0;
wnewHeight = 0;
img.onload = function() {
newWidth = (img.width*0.5);
newHeight = (img.height*0.5);
//return [newWidth , newHeight];
}
alert (newWidth);