likemike Posted May 20, 2025 Posted May 20, 2025 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
likemike Posted May 20, 2025 Author Posted May 20, 2025 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?
likemike Posted May 21, 2025 Author Posted May 21, 2025 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.
likemike Posted May 21, 2025 Author Posted May 21, 2025 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; }
Recommended Posts