1
I’m trying to open an image that’s on a site of mine, I can’t use Twebbeowser because it has a vertical scrollbar that I can’t remove, so I only have Timage.
1
I’m trying to open an image that’s on a site of mine, I can’t use Twebbeowser because it has a vertical scrollbar that I can’t remove, so I only have Timage.
2
You can use the Idhttp component for this. Create a new project, play an Idhttp component and another Idantifreeze in the form, also a Timage and a Tbutton. Then add the following code to the Button Onclick event:
var
Jpeg: TJpegImage;
Strm: TMemoryStream;
begin
Screen.Cursor := crHourGlass;
Jpeg := TJpegImage.Create;
Strm := TMemoryStream.Create;
try
IdHttp.Get('http://www.site.com.br/imagem.jpg', Strm);
if (Strm.Size > 0) then
begin
Strm.Position := 0;
Jpeg.LoadFromStream(Strm);
Image1.Picture.Assign(Jpeg);
end;
finally
Strm.Free;
Jpeg.Free;
Screen.Cursor := crDefault;
end;
If the image is too heavy, I recommend to throw this procedure inside a thread.
I hope I’ve helped!
Browser other questions tagged delphi web-application image
You are not signed in. Login or sign up in order to post.
Get a look at this link: https://stackoverflow.com/questions/1227646/how-to-get-images-from-url-in-delphi
– gato