LazReport, handle db image streams the same way as dbimage

git-svn-id: trunk@43780 -
This commit is contained in:
jesus 2014-01-22 08:13:55 +00:00
parent 7ee5132796
commit 05d2879059

View File

@ -4983,10 +4983,9 @@ var
GraphExt: string;
gc: TGraphicClass;
AGraphic: TGraphic;
CurPos: Int64;
function LoadImageFromStream: boolean;
var
CurPos: Int64;
begin
result := (s<>nil);
if result then
@ -5021,27 +5020,32 @@ begin
if assigned(CurReport.OnDbImageRead) then
CurReport.OnDBImageRead(Self, s, GraphExt)
else
if LoadImageFromStream then
exit;
try
if GraphExt='' then begin
begin
CurPos := s.Position;
try
GraphExt := s.ReadAnsiString;
if Length(GraphExt)>10 then
GraphExt := ''; // even 10 would mean we have a false positive
except
s.Position := CurPos;
GraphExt := '';
end;
end;
if GraphExt<>'' then begin
gc := GetGraphicClassForFileExtension(GraphExt);
if assigned(gc) then
begin
AGraphic := gc.Create;
AGraphic.LoadFromStream(s);
Picture.Assign(AGraphic);
end;
except
end else
GraphExt := '';
end;
if GraphExt='' then
LoadImageFromStream;
finally
s.Free;
AGraphic.Free;