View Full Version : fit image size on panel

30 Jul 2013, 5:30 AM
I got a panel and want to display a picture there.
i gave the Panel a fixed size and the image shall fit to this size.
If i gave the image a fixed size --> image gets streched.....
If i dont gave the image a fixed size, its shown in its true size, which means its bigger than my panel.

id: r.id.card.pan_foto2,
xtype: 'panel',
bodyPadding: 10,
height: 320,
width: 320,
y: 340,
x: 381,
id: r.id.card.werbung_image2,
xtype: 'image',
width: 300,
height: 300,
src: 'path/image',

Gary Schlosberg
31 Jul 2013, 5:53 PM
Is your goal to have the image shrink down to fit in the panel? If so, perhaps shrinkWrap would work for you:

5 Aug 2013, 2:59 AM
I solved the problem by myself, but thank you for your answer.

If anyone is interested in the solution:

I just used a Panel and put the image directly on it:

id: r.id.card.pan_foto1,
xtype: 'panel',
bodyPadding: 10,
height: 320,
width: 320,
html: '<img src="app/images/accordion.png" style="max-height:100%; max-width:100%;"/>',
x: 30,
y: 340,

the red marked code put the image with the max size in the panel, without streching it.

11 Jun 2015, 4:46 AM
Hi! Can you tell me whats wrong with this setup? The Shrink Wrap does not seem to work... or I'm doing something wrong...https://fiddle.sencha.com/#fiddle/of5

E (https://fiddle.sencha.com/#fiddle/of5)dit: For anyone looking for the same problem, see the answer here: https://www.sencha.com/forum/showthread.php?302148-Shrink-image-(Ext.Img)-to-fit-parent-Panel