title: Dynamic window size in ExtJs
body: <p>I am using ExtJS for my project.</p>
  
  <p>I need to create a window in ExtJS of variable size to display an image my user has uploaded.</p>
  
  <p>But, if a smaller image say 150x150 is uploaded, I want the window to "fit" the image, i.e., the window should be 150x150.</p>
  
  <p>But if a larger image, say 3000x3000 is uploaded, then I want the window to be only 800x600, with the image properly resized and rendered inside it.</p>
  
  <p>I want to do this in ExtJS. Here's my code for the image viewer. Please help me find a solution here.</p>
  
  <pre><code>    viewWin = new Ext.Window({
            title : title,
      layout  : 'auto',
      width   : '50%',
         resizable: false,
      shadow  : true,
      items   : [new Ext.ux.MediaPanel({
              border  : false,
              style   : {width:'100%', height:'100%'},
              mediaCfg : {
                  mediaType: 'JPEG',
                  url :  url,
                  }
          })]
  });
  </code></pre>