Re: How to detect an image type with GD



"Francesco Moi" <francescomoi@xxxxxxx> 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/
.