hier mal meine Lösung:
bei
INDY IdHTTP1 ist der Useragent hoch zu sezten, da manche Provider sonst den download blocken:
Code:
IdHTTP1.Useragent:='Mozilla/5.0 (Linux; Android 7.1.2; Nexus 5 Build/NJH47F) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/62.0.3202.84 Mobile Safari/537.36';
für https musst Du die entsprechende SSL Komponente zuweisen:
Code:
IdHTTP1.IOHandler:=IdSSLIOHandlerSocketOpenSSL1;
Code:
function ImageLoad(Picture: TPicture; FileName: string; WBImager:TWebBrowser=nil): Boolean;
var LStream: TMemoryStream;
f: string;
c: TCursor;
begin
result := False;
// Picture:=nil;
if Trim(FileName) = '' then Exit;
if WBImager<>nil then WBImager.Tag:=10; // keine Datei
try
if (Pos('http', lowercase(FileName)) > 0) or (Pos('www', lowercase(FileName)) > 0) then begin
if WBImager<>nil then begin
WBImager.Tag:=11; // Datei, aber noch nicht geladen
if WBImager.Hint<>FileName then begin
WBImager.Hint:=FileName;
WBImager.Navigate(FileName);
end;
WBImager.Tag:=20; // Datei geladen
result := True;
end else begin
LStream := TMemoryStream.Create;
c := Screen.Cursor;
Screen.Cursor := crHourGlass;
try
IdHTTP1.Get(FileName, LStream);
LStream.Position := 0;
f := Temp_Path + 'bild' + Copy(FileName, p_RInstr(0, FileName, '.'), 10);
LStream.SaveToFile(f);
Picture.LoadFromFile(f);
result := True;
FreeAndNil(LStream);
DeleteF(f);
result := True;
except
FreeAndNil(LStream);
end;
Screen.Cursor := c;
end;
end else begin
if FileExists(FileName) then begin
Picture.LoadFromFile(FileName);
result := True;
end;
end;
except
end;
end;