-
4 Jan 2013 8:22 AM #1
Answered: ExtJS get an image to not stretch
Answered: ExtJS get an image to not stretch
I have the following situation (Extjs 4.1), I have an `Ext.Img` component looking something like this:
xtype: 'image',
src: '#',
regioin: 'south',
width: 700,
height: 200
Now, my problem is that the image on this frame appear to be stretched to match the size of the frame, is there any way to prevent the image from stretching. For example if in HTML I do something like this:
<img src='#'/> (Height and width not specified)
Then the size of the image is fine. So that's what I want, I want the image to be the same size as it if was an image tag with height and width not specified, can anyone help? Someone elsewhere suggested adding `maxWidth` and `maxHeight`, but the image will still be stretched to those values. So, any suggestions are appreciated, please tell me if anything is not clear and I will try to clarify.
-
Best Answer Posted by droessner
You could wrap your image component in a container and then not specify a width/height.
Does that work for you?Code:xtype: 'container', region: 'south', width: 700, height: 200, items: [{ xtype: 'image', src: '#' }]
-
4 Jan 2013 9:29 AM #2
You could wrap your image component in a container and then not specify a width/height.
Does that work for you?Code:xtype: 'container', region: 'south', width: 700, height: 200, items: [{ xtype: 'image', src: '#' }]
-
4 Jan 2013 10:12 AM #3


Reply With Quote