VoyForums
[ Show ]
Support VoyForums
[ Shrink ]
VoyForums Announcement: Programming and providing support for this service has been a labor of love since 1997. We are one of the few services online who values our users' privacy, and have never sold your information. We have even fought hard to defend your privacy in legal cases; however, we've done it with almost no financial support -- paying out of pocket to continue providing the service. Due to the issues imposed on us by advertisers, we also stopped hosting most ads on the forums many years ago. We hope you appreciate our efforts.

Show your support by donating any amount. (Note: We are still technically a for-profit company, so your contribution is not tax-deductible.) PayPal Acct: Feedback:

Donate to VoyForums (PayPal):

Login ] [ Contact Forum Admin ] [ Main index ] [ Post a new message ] [ Search | Check update time | Archives: 1234[5]678910 ]


[ Next Thread | Previous Thread | Next Message | Previous Message ]

Date Posted: 09:22:12 08/26/02 Mon
Author: Brian Lowe
Subject: Re: GIF thumbnail
In reply to: Brian Lowe 's message, "GIF thumbnail" on 09:17:32 08/26/02 Mon

Hi Michel,

Here is the same source code with some HTML formatting to make it easier to read:

if (AnsiUppercase(ExtractFileExt(FileList.Items[Index].Caption)) = '.GIF') then
begin
try
FPicture.LoadFromFile(FileList.Items[Index].Caption);
ADibGraphic := TDibGraphic.Create;
AStream := TMemoryStream.Create;
try
FPicture.Graphic.SaveToStream(AStream);
ADibGraphic.LoadFromStream(AStream);
FPicture.Graphic := ADibGraphic;
finally
ADibGraphic.Free;
AStream.Free;
end;
ValidImage := True;
except
ValidImage := False;
end;
end else
begin
ADibGraphic := EnDiGrph.NewDibGraphic(FileList.Items[Index].Caption);
try
FPicture.Graphic := ADibGraphic;
if FPicture.Graphic <> nil then
begin
FPicture.Graphic.LoadFromFile(FileList.Items[Index].Caption);
ValidImage := True;
end else
ValidImage := False;
finally
ADibGraphic.Free;
end;
end;
end;

>
>I am using your version 2 thumbnail generator, which
>works great for TDibGraphics but has trouble in
>DrawGridDrawCell for TGraphics.
>
>To solve the problem of "Invalid type cast" at
>
>FResizeTransform.Apply(FPicture.Graphic as
>TDibGraphic);
>
>I read your posts about unregistering Delphi native
>types and modified the .INC file. Now I get an
>exception that GIF is not supported. (I have TGifImage
>installed.) I tried the following to load a GIF into a
>TDibGraphic but the graphic is empty. Can you see
>where my problem can be, or suggest a better solution?
>
>if
>(AnsiUppercase(ExtractFileExt(FileList.Items[Index].Cap
>tion)) = '.GIF') then
>begin
> try
>
>FPicture.LoadFromFile(FileList.Items[Index].Caption);
> ADibGraphic := TDibGraphic.Create;
> AStream := TMemoryStream.Create;
> try
> FPicture.Graphic.SaveToStream(AStream);
> ADibGraphic.LoadFromStream(AStream);
> FPicture.Graphic := ADibGraphic;
> finally
> ADibGraphic.Free;
> AStream.Free;
> end;
> ValidImage := True;
> except
> ValidImage := False;
> end;
> end else
> begin
> ADibGraphic :=
>EnDiGrph.NewDibGraphic(FileList.Items[Index].Caption);
> try
> FPicture.Graphic := ADibGraphic;
> if FPicture.Graphic <> nil then
> begin
>
>FPicture.Graphic.LoadFromFile(FileList.Items[Index].Cap
>tion);
> ValidImage := True;
> end else
> ValidImage := False;
> finally
> ADibGraphic.Free;
> end;
> end;
>end;
>
>Thanks!
>Brian Lowe

[ Next Thread | Previous Thread | Next Message | Previous Message ]


Replies:


[ Contact Forum Admin ]


Forum timezone: GMT-5
VF Version: 3.00b, ConfDB:
Before posting please read our privacy policy.
VoyForums(tm) is a Free Service from Voyager Info-Systems.
Copyright © 1998-2019 Voyager Info-Systems. All Rights Reserved.