How to detect an image type with GD
Hi.
I want to load an image with GD, but I must know which type is each one
in order to:
my $srcimage = GD::Image->newFromGif("foo.gif");
my $srcimage = GD::Image->newFromJpeg("foo.jpg");
....
How can I detect it? Thank you very much.
Re: How to detect an image type with GD
"Francesco Moi" <francescomoi [at] usa.com> wrote:
> Hi.
>
> I want to load an image with GD, but I must know which type is each one
> in order to:
> my $srcimage = GD::Image->newFromGif("foo.gif");
> my $srcimage = GD::Image->newFromJpeg("foo.jpg");
> ...
>
> How can I detect it? Thank you very much.
With magic: http://search.cpan.org/search?query=magic&mode=all
--
John Experienced Perl programmer: http://castleamber.com/
Perl help, tutorials, and examples: http://johnbokma.com/perl/
Re: How to detect an image type with GD
[A complimentary Cc of this posting was sent to
Francesco Moi
<francescomoi [at] usa.com>], who wrote in article <1163005823.701417.13950 [at] b28g2000cwb.googlegroups.com>:
> Hi.
>
> I want to load an image with GD, but I must know which type is each one
> in order to:
> my $srcimage = GD::Image->newFromGif("foo.gif");
> my $srcimage = GD::Image->newFromJpeg("foo.jpg");
> ...
>
> How can I detect it?
Do not. Let GD detect it.
Hope this helps,
Ilya