Image in a fixed size box? - flutter

I'm trying to display images in a fixed size box (the grey area in the image here). When the submit button is pressed new images will be fetched from the internet. But the images will be different sizes.
So to prevent the "submit" button moving up and down due to different size images (and potentially having it off the screen) I'd like the images to fit inside the box. (I suppose there are a few options there, for example having the image resize to fit in the box or having the image be clipped and still fitting in the box.) I've been messing with containers and columns etc for ages but nothing seems to work.
what is the best way to fit images of different sizes into a fixed size box ?

The Image widget can have a height be specified. You can read more about that here

Related

How to avoid image rendering over original image size in "click-enlarge mode" (css-styled-content)

If I set some value for styles.content.imgtext.linkWrap.width or styles.content.imgtext.linkWrap.height small images will be rendered to this value instead in its original size.
How can I achieve, that great images will be decreased to my value but small images won't be enlarged to this value?
You can find the following setting in the TYPO3 Install Tool:
[GFX][processor_allowUpscaling]
Uncheck this checkbox to prevent upscaling of smaller images.

Eclipse RCP displays images in a DecorationOverlayIcon to big, how do I get it smaller?

I basically want to make overlays like you know them from the package explorer in eclipse, a base image, and a smaller picture laid above in the bottom right corner. I used DecorationOverlayIcon for this and fist some pics from the already existing resources just to if it works. It the overlays showed up, but even though I had given the following instructions
imageDescriptorArray[IDecoration.BOTTOM_RIGHT] = alreadyExistingImageDescriptor;
DecorationOverlayIcon(baseImage, overlaysArray);
the overlayed image was very big. Than I made my icon, which is a 16x16 .png. It like the other pictures covers up the icon almost completely. How do I make the image smaller, do I have to convert it to a smaller size like 8x8 for that, or alternatively, how do I push it further down?
DecorationOverlayIcon doesn't resize anything so you must provide small images for the overlays.
There is also no way to change the calculated position of the overlays.

How to overlay text on image using swift?

First of all, I am using Auto Layout for this Swift application. In one view, i have an image that scales to full screen. And over this image there is an overlay text.
The problem is; When opening in iPhone6, the image scales and fits nicely but the text misplaces (normally) on the image, since the constraints are still the same.
I was thinking of merging the text and the image into one image layer so they scale and fit together. Is this possible ?
Or, anyone knows any other solution rather than trying to understand device and changing text placement contstraints accordingly ?
if you are using auto layout for display text in Lable. than must you have to play with constrain from interface builder. share you screenshot

UI Button with Image Smaller than Touchable Area

I've not much response so am adding some more info.
My buttons are not rectangular, nor organised in a grid so I need a way of creating what looks like a button (and shows that it has been pressed visually, as per a standard UIButton) but where the touchable area is different to the image area.
I am using a transparent PNG and that element works fine. I've added the buttons in Interface Builder and am wondering if that is the problem.
However, if I change imageEdgeInsets, it distorts the image display, which is obviously not what I want.
Bizarrely, if I increase the dimemsions of the button, it doesn't change the image, but if I decrease them it does.
I have tried different combinations of mode (scale to fill etc), but to no avail.
I am aware that there is an image and background image property, but in IB there is only one.
Essentially, I don't understand how the geometry works and the Apple documentation doesn't seem to help.
Surely, I can't be the only person to try to do this. Any help would be warmly welcomed.
Many thanks,
Chris.
Try setting the buttons setting to Aspect Fit. This will fill the button with your image so a smaller image than the button size would leave the space around the image.
Also set the button type to custom.
In the end, I stumbled across Ole Begemann's Non-rectangular buttons class. It just does what I need - to be able to create buttons where the touchable area follows the visible element of a non rectangular image.
#Helium3 - thanks - that allowed me to use a larger touch area, bit not a smaller one.

iPhone - UIButton background image is cut off sometimes

I am using a custom image as the background image for my buttons. I have noticed that the edges of the buttons are cut off sometimes. My buttons vary in size but the behavior doesn't seem to be dependent on the button size. I am creating the buttons programatically. The image I am using is pretty large to cover the entire background.
Can someone please let me know what could be the issue?
More info
Setting the content mode to UIViewContentModeScaleToFill still cuts of the images. Also tried resizing the image but doesn't make a difference.
Thanks.
Did you try setting the button's dimensions to fit exactly the image?
Is the image just cropped or also blurry (cause it's being resized)? Have you toyed around with UIView's contentMode property for the button?
If you did, did you try increasing/decreasing the width or height by a pixel? I sometimes had blurry buttons even though its dimensions were exactly the image's. Adding or removing an extra pixel sometimes helped.
I finally resolved this by creating a 3x3 px image with the background color as the button's color and a 1 px border surrounding the image. Then used the UIImage method stretchableImageWithLeftCapWidth:topCapHeight: to create an image with the desired border size of 1 px.