How to detect an image type with GD
am 08.11.2006 18:10:23 von Francesco Moi
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
am 08.11.2006 21:03:16 von John Bokma
"Francesco Moi" 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
am 08.11.2006 21:22:52 von Ilya Zakharevich
[A complimentary Cc of this posting was sent to
Francesco Moi
], who wrote in article <1163005823.701417.13950@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