Topic: Downloading a web image

Hi

I have an image component placed on a form. The image component is named Image1.

I want to load a picture in this image component from the web.

The path for this picture for example is this: https://www.usedparts.gr/img/p/2/1/3/5/3/21353.jpg

How can I accomplish this. I am trying to use HTTPget but I am not succesfull.

Thank you
George

Re: Downloading a web image

I managed to get the HTTpget to work by installing the latest dll files openssl-1.0.2q-i386-win32.zip that I found online in the root folder of my application.

So the question is if I can directly assign the jpg picture I get using the HTTPget request directly to the image object on the form without saving the image to my hdd before. Is this feasable?

Thank you

Re: Downloading a web image

Ok i managed to amke this work.

I have a table grid that displays info for parts in my wharehouse.
When a user clicks on a row on the grid pictures of the part are downloaded from my web site and they are displayed in 4 image components on a form.

This is the code I used:  (sorry some parts are in greek)

procedure Form1_TableGrid1_OnCellClick (Sender: TObject; ACol, ARow: Integer);
var
url,image_name :string  ;   // για την αποθηκευση των url της τοποθεσιας εως 4 φωτογραφιών ανα προιόν (αν υπάρχουν τόσες)
mikosPinakaUrls :integer;          // αποθηκεύει την θέση που βρίσκεται το διαχωριστικό (;) στο path των φωτογραφιών
urls: array of string;
localImageFileName : array of string;
metritisFor:integer;
ThePicture: TComponent;
begin


gridRowSelected:=form1.TableGrid1.SelectedRow;

url:=form1.TableGrid1.Cells[40,gridRowSelected];           //παιρνω το αρχικο path των φωτογραφιών με όλες τις φωτογαρφίες
urls:=SplitString(url,';');                                //σπαω και αποθηκευω το αρχικο path στα επιμέρους path των γωτογραφιών και τα αποθηκεύω σε πίνακα
mikosPinakaUrls:=length(urls);                             //βρίκσω το μήκος του πίνακα
setlength(localImageFileName,mikosPinakaUrls);

for metritisFor:=0 to  mikosPinakaUrls - 1  do             //τρεχω λουπ τόσες φορές όσο και το μήκος του πίνακα για να φορτώσω τις φωτό
begin

    if metritisFor < 4 then                                     //για να φορτώσω μόνο 4 φωτο. αν υπάρχουν παραπάνω τις αγνοώ.
        begin
        urls[metritisFor]:=ReplaceStr(urls[metritisFor],'https','http');
        HTTPGetFile(urls[metritisFor], ExtractFilePath(Application.ExeName) + 'image'+ inttostr(metritisFor) +'.jpg', True);
        localImageFileName[metritisFor]:=ExtractFilePath(Application.ExeName) + 'image'+ inttostr(metritisFor) +'.jpg';
        ThePicture := form1.FindComponent('Image'+IntToStr(metritisFor+1));
        Timage(ThePicture).Picture.LoadFromFile(localImageFileName[metritisFor]);

        end;


end;

end;