var img = new Image (); img.onload = function () { alert (this.width + 'x' + this.height); Ext.query('.button_ext_class').setStyle({'width' : this.width+'px', 'height' : this.height+'px'}); }