Autor Beitrag
bawa
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 49



BeitragVerfasst: Sa 30.12.06 22:03 
Hi,
Giebt es die möglichkeit ein bild aus dem Internet direkt in mein TImage zu laden. Das sollte ohne zwischenspeichern und im Programm gehen.
ausblenden Delphi-Quelltext
1:
Bild1.Picture.LoadFromFile('http://www.xyz.de/bild.jpg')					

geht leider nicht kann mir wer eine lösung vorschlagen?
rey003
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 68

Win XP
BDS 2006
BeitragVerfasst: Sa 30.12.06 22:14 
Hallo,
du kannst mit den Indys das Bild in einen Stream und dann das Bild aus dem
Stream in die TImage-Komponente laden!

_________________
Daniel S.
bawa Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 49



BeitragVerfasst: Sa 30.12.06 22:19 
Danke ich werds ausprobieren!
bawa Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 49



BeitragVerfasst: So 31.12.06 18:51 
Okay... ich bekomms nicht hin -- wie streame ich ein bild aus dem internet zb: http://archives.cnn.com/2000/TECH/space/04/13/chandra.supernova/large.supernova.jpg

in ein TMemoryStream und dann direkt in mein TImage?

Ps: bitte verständlich erklären bin noch newbi in delphi :)


Zuletzt bearbeitet von bawa am So 31.12.06 19:01, insgesamt 1-mal bearbeitet
rey003
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 68

Win XP
BDS 2006
BeitragVerfasst: So 31.12.06 19:00 
Es kommt immer drauf an von welchen typ das Bild ist! Ich habe das mal für ein Programm geschrieben, das CoverParadies angesteuert hat
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
 image:= TJPEGImage.Create;
  try
   imagestream:= TMemoryStream.Create;
    try
     imagestream.Seek(0,sofrombeginning);
     //Download in imagestream
     CoverB.DownloadCover(Front,imagestream);
     //Stream auf Position 0 setzen
     imagestream.Seek(0,sofrombeginning);
     image.LoadFromStream(imagestream);
     // in TImage ein TJPEGImage erzeugen
     Image1.Picture.Graphic:= TJPEGImage.Create;
     // Jpeg in TImage setzen
     image1.Picture.Graphic.Assign(image);
    finally
     imagestream.Free;
    end;
  finally
   image.Free;
  end;

Ich hoffe das hilft dir erstmal! Ich hab grade nicht mehr Zeit gehabt! Wenn du willst kann ich dir das morgen noch mal ausführlich beschreiben!

Guten Rutsch! :wink:

_________________
Daniel S.
bawa Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 49



BeitragVerfasst: So 31.12.06 19:02 
Danke das sieht ja schon mal vielversprechend aus -- guten rutsch
rey003
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 68

Win XP
BDS 2006
BeitragVerfasst: So 31.12.06 19:03 
Der Download:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
procedure TCover.DownloadCover(URL:string;var ziel: TMemoryStream);
var
 HTTP: TIdHTTP;
begin
 HTTP := TidHTTP.Create(self);
 try
  //Zur Sicherheit
  ziel.Seek(0,sofrombeginning);
  //Download
  HTTP.Get(URL, ziel);
 finally
  HTTP.free;
 end;
 ziel.Seek(0,sofrombeginning);
end;


//Edit: Ob das mit dem try finaly end; jetzt so geht weiß ich nicht! Kann es jetzt auch nicht testen! :wink: Kann sein das das HTTP.free; zu zeitig kommt!

_________________
Daniel S.
bawa Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 49



BeitragVerfasst: So 31.12.06 19:11 
Super es funktioniert!