You can upload an image outside the DOM and get its dimensions ... You can put this inside a function:
var myImg = new Image();
myImg.src = dynamicUrl;
myImg.onload = function() {
var width = myImg.width;
var height = myImg.height;
var scale = 0.5;
var viewer = Raphael(0,0,width, height);
viewer.image(dynamicUrl, 0, 0, width*scale, height*scale);
}
jsFiddle
Now you can divide or multiply the values widthand heightthe scale. Make sure you pay attention to time.
Also, once the image is in Raphael, you can use .scale()
source
share