ExtJS 4: How to auto scale an image? (no clipping)

simonwidjaja picture simonwidjaja · Apr 8, 2012 · Viewed 10.8k times · Source

I have an Image Component in ExtJS which loads an image via URL like this:

        {
            xtype: 'image',
            width: 200,
            height: 200,
            src: 'http://www.asien-news.de/wp-content/uploads/new-york.jpg'
        },

The image is displayed at 100%. 200x200 px are shown and the rest is clipped. I didn't find any property to allow scaling.

What is the best way to achieve a resizing image in ExtJS?

Answer

Feroz picture Feroz · Feb 27, 2013

You can use xtype:'image' , shrinkWrap:true

Please check with Ext js api http://docs.sencha.com/ext-js/4-1/#!/api/Ext.Img-cfg-shrinkWrap