Delphi-PRAXiS

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   Object-Pascal / Delphi-Language (https://www.delphipraxis.net/32-object-pascal-delphi-language/)
-   -   Delphi JPG mit Indy per HTTP einbinden ? (https://www.delphipraxis.net/44208-jpg-mit-indy-per-http-einbinden.html)

Nisbo 15. Apr 2005 12:06


JPG mit Indy per HTTP einbinden ?
 
Moin Moin,

Ist es möglich ein JPG-Bild mit Indy 10 per HTTP in Delphi 5 Standard einzubinden ?
Falls ja würde mich natürlich interessieren wie ;)

Also ich habe ein TImage und würde dort gerne ein JPG ala http://www.domain.de/bild.jpg einbinden

Nisbo 15. Apr 2005 12:44

Re: JPG mit Indy per HTTP einbinden ?
 
habemir mal was aus teilen die ich so gefunden habe gebastelt, aber ob das das wahre ist ?

Delphi-Quellcode:
function DownloadFile(SourceFile, DestFile: string): Boolean;
begin
  try
    Result := UrlDownloadToFile(nil, PChar(SourceFile), PChar(DestFile), 0, nil) = 0;
  except
    Result := False;
  end;
end;


procedure TForm1.Button2Click(Sender: TObject);
var SourceFile, DestFile : string;
begin
  SourceFile := 'http://www.domain.de/bild.jpg';
  DestFile  := ExtractFilePath(ParamStr(0)) + 'temp.jpg';

  if DownloadFile(SourceFile, DestFile) then
  begin
    ShellExecute(Application.Handle, PChar('copy'), PChar(DestFile), PChar(''), nil, SW_NORMAL);
    Image1.Picture.LoadFromFile(PChar(ExtractFilePath(ParamStr(0))) + 'temp.jpg');
    DeleteUrlCacheEntry(PChar(SourceFile));
  end
  else
    ShowMessage('Verbindungsfehler')
end;
funktionieren tut es jedenfalls


Alle Zeitangaben in WEZ +1. Es ist jetzt 01:50 Uhr.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz