On Sunday 09 October 2016 14:51:05 tea wrote:
> 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
FCL TStream and MSEgui TStream are different because of forked classes unit.
Please add "mclasses" after "classes" in "uses" of Synapse sources as ZEOSlib
did. Example from ZEOSlib:
"
unit ZAbstractConnection;
interface
{$I ZComponent.inc}
uses
Types,
[...]
SysUtils, Classes, {$IFDEF MSEgui}mclasses, mdb{$ELSE}DB{$ENDIF},
ZDbcIntfs, ZCompatibility, ZURL;
"
------------------------------------------------------------------------------
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