Ciao, ho questa funzione:

Codice PHP:
function scaleImage() {
  var 
image document.getElementById('eg_photo');
  
  
o_width image.width;
  
o_height image.height;

  if(
o_width > {MAX_WIDTH} || o_height > {MAX_HEIGHT}){
    
//do resize
    
perc_w = {MAX_WIDTH} / o_width;
    
perc_h = {MAX_HEIGHT} / o_height;
    
    if(
perc_h perc_w){
      
width = {MAX_WIDTH};
      
height Math.round(o_height perc_w);
    } else {
      
height = {MAX_HEIGHT};
      
width Math.round(o_width perc_h);
    }
    
    
image.height height;
    
image.width width;
    
    var 
warning document.createElement('div');
    
warning.className 'small';
    
warning.style.width width 'px';
    
warning.innerHTML '{EG_PHOTO_THIS} ' o_width ' * ' o_height ' {EG_PHOTO_PIXELS}' + (image.fileSize ' {EG_PHOTO_AND} ' Math.floor(image.fileSize/1024) + 'KB' '') + ' {EG_PHOTO_LARGE}. {EG_PHOTO_CLICK} [url="javascript:void(0);"]{EG_PHOTO_HERE}[/url] {EG_PHOTO_TO_VIEW}';
    
    
image.parentNode.appendChild(warning);
  }

applicata a

codice:
<div class="view-photo">
[img]{IMAGE_SRC}[/img]

</div>
E non funziona perchè image.width e image.height sono sempre uguali a 0... :rollo: perchè? Da cosa può dipendere?

Grazie :quote: