|
<< Click to Display Table of Contents >> Navigation: Telegram > 2021 > 04 > 09 > Telegram_2021-04-09T21 |
2021-04-09T21:01:37
procedure TIPicture.LoadPicture;
const
IID_IPicture: TGUID = (D1: $7BF80980; D2: $BF32; D3: $101A; D4: ($8B, type: cashtag $BB , $00, type: cashtag $AA , $00, $30, $0C, type: cashtag $AB ));
var
hGlobal: THandle;
pvData: pointer;
pstm: IStream;
hr: hResult;
gifstream: TMemoryStream;
i: Integer;
b, c, d, e: byte;
skipimg: Boolean;
imgidx: Integer;
begin
hGlobal := GlobalAlloc(GMEM_MOVEABLE, FDatastream.Size);
if (hGlobal = 0) then
raise Exception.Create('Could not allocate memory for image');
try
pvData := GlobalLock(hGlobal);
FDatastream.Position := 0;
FFrameXPos := 0;
FFrameYPos := 0;
FAnimMaxX := 0;
FAnimMaxY := 0;
{ skip first image ctrl }
if IsGIF and (FrameCount > 0) then
begin
// manipulate the stream here for animated GIF ?
gifstream := TMemoryStream.Create;
imgidx := 1;
skipimg := False;
FDatastream.Position := 6;
FDatastream.Read(FAnimMaxX, 2);
FDatastream.Read(FAnimMaxY, 2);
for i := 1 to FDatastream.Size do
begin
FDatastream.Position := i - 1;
FDatastream.Read(b, 1);
if (b = $21) and (i + 8 < FDatastream.Size) then
begin
FDatastream.Read(c, 1);
FDatastream.Read(d, 1);
FDatastream.Position := FDatastream.Position + 5;
FDatastream.Read(e, 1);
if (c = $F9) and (d = $4) and (e = $2C) then
begin
if imgidx = FFrame then
begin
FDatastream.Read(FFrameXPos, 2);
FDatastream.Read(FFrameYPos, 2);
FDatastream.Read(FFrameXSize, 2);
FDatastream.Read(FFrameYSize, 2);
end;
inc(imgidx);
if imgidx <= FFrame then
skipimg := True
else
skipimg := False;
end;
end;
if not skipimg then
gifstream.write(b, 1);
end;
gifstream.Position := 0;
gifstream.ReadBuffer(pvData^, gifstream.Size);
gifstream.Free;
end
else
FDatastream.ReadBuffer(pvData^, FDatastream.Size);
GlobalUnlock(hGlobal);
pstm := nil;
// Create IStream* from global memory
hr := CreateStreamOnHGlobal(hGlobal, True, pstm);
if (not hr = S_OK) then
raise Exception.Create('Could not create image stream')
else if (pstm = nil) then
raise Exception.Create('Empty image stream created');
// Create IPicture from image file
hr := OleLoadPicture(pstm, FDatastream.Size, False, IID_IPicture, gpPicture);
if (not(hr = S_OK)) then
raise Exception.Create('Could not load image. Invalid format')
else if (gpPicture = nil) then
raise Exception.Create('Could not load image');
finally
GlobalFree(hGlobal);
end;
end;
2021-04-09T21:02:07
tms OLE crap for loading images for some stuff... seems to give us fits.... from 'Could not allocate memory for image' to 'Could not load image. Invalid format'
2021-04-09T21:02:37
I have no idea WHAT or why its even running this.. assume property crap in their grids for some images that we never use or even care about.
But because its always there, this call runs.
2021-04-09T21:54:30
Hello!
2021-04-09T21:54:44
I need my app.min.js to be above the scripts that intraweb creates. How can I do this?