ecco, allora devi scriverle prima nel tag, tipo via server-side oppure se non sono nel tag img da cui carichi l'immagine devi andare a creare un oggetto Image (javascript) passando il percorso del file

Tanto per esplicitare la cosa un pochino

codice:
function scaleImage() { 
  var image = new Image();
  image.src = document.getElementById('eg_photo').src; 
   
  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} {EG_PHOTO_HERE} {EG_PHOTO_TO_VIEW}'; 
     
    document.getElementById('eg_photo').parentNode.appendChild(warning); 
  } 
}