Jump to content

Recommended Posts

Posted

Hi!

When I use the URL method of a TUnimImage to download an image, the parameters center, stretch, autosize don't work. Instead the left upper corner of the image is displayed in the middle of the screen (see attachment).

Is there a solution (maybe with CSS)?

Thanks in advance

Mike

test.png

Posted

After assigning an URL I want to save the image by code:

UnimImage.Picture.SaveToFile(xxx)

But it only creates the image file with 0 bytes. What do I wrong?

Posted

I helped myself by downloading the image first using HttpClient and later assigning the image with UnimImage.Picture.LoadFromFile (...). Now the parameters center, stretch, autosize are working like expected.

Posted

For those, you must use the URL property of an UnimImage, here is a good CSS for centering the image in the best fitting way:

.imgAnexo img {
  display: block;
  margin: 0 auto;
  width: 100%;
  maxHeight: 100%;  
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  object-fit: contain;  
}  

 
 

×
×
  • Create New...