How to load a picture in JPEG format from a stream?

Code:
----------*----------*----------
function tmainfo.LoadPictureFromURL(const AURL: msestring): tMaskedBitmap;
var
 ICnct : tHTTPSend;
 TmpImg : tImage;
begin
 ICnct:=tHTTPSend.Create;
 with ICnct do begin
   if HTTPMethod('GET', AURL)
    then begin
      TmpImg:=tImage.Create(nil);
      TmpImg.Bitmap.LoadFromStream(tStream(Document), 'jpeg', []);
//      Document.SaveToFile('###.jpg');
//      TmpImg.Bitmap.LoadFromFile('###.jpg', 'jpeg', []);
      Result:=TmpImg.Bitmap;
     end;
  end;
end;
----------*----------*----------
Error: Graphic format error: jpeg.

If SaveToFile and LoadFromFile then Ok.

(tHTTPSend from Synapse, tHTTPSend.Document : FPC tMemoryStream)
At compile time: Message Warning: Class types "TMemoryStream" and "tstream" are 
not related



------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most 
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________
mseide-msegui-talk mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mseide-msegui-talk

Reply via email to