<html> <head> <title>{$this->title}</title> </head> <body> <body style="margin:0;padding:0;"> <script type="text/javascript"> {if:$this->img} var img_url = '{theme:user/img/mb/$this->img}?'+Date.parse(new Date()); var img = new Image(); img.src = img_url; var check = function(){ }; var set = setInterval(check,40); img.onload = function(){ clearInterval(set); document.body.innerHTML +='<div class="picDialog" id="model_img" style="width: 100%;height: '+img.height+';background: url('+img.src+') no-repeat center top;"></div>'; console.log(img.height); }; {/if} </script> </body> </html>