I have a UIComponent and inside it I put a loader (which loads an image file).
THE PROBLEM:
Even though I resize the UIComponent(to a square), it will still follow the size of the image in the loader. But when I resize the image in the loader, it will become stretched. What I want to do is have a container(UIComponent) that has a fixed square size and after the image has been loaded it will just fit in the dimention of the container without being stretched. Can anyone help me how to do that?
I’ve long been using this function to resize an image while preserving the aspect ratio:
The function will give you the ideal dimensions to fit
sourcewithintarget. So, in your case, you can use it that way: