Click here to get back home

How to detect an image type with GD

 HomeNewsGroups | Search | About
 comp.lang.perl.modules    Post an article   get this group's latest topics as an RSS feed add this group's latest topics to your My MSN content add this group's latest topics to your My Yahoo content
Subject Author Date
How to detect an image type with GD Francesco Moi 11-08-2006
Posted by Francesco Moi on November 8, 2006, 12:10 pm
Please log in for more thread options


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.


Posted by John Bokma on November 8, 2006, 3:03 pm
Please log in for more thread options



> 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/

Posted by Ilya Zakharevich on November 8, 2006, 3:22 pm
Please log in for more thread options


[A complimentary Cc of this posting was sent to
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?

Do not. Let GD detect it.

Hope this helps,
Ilya





Similar ThreadsPosted
GD: How to know image type? (JPEG, PNG, ..) January 15, 2008, 6:36 am
HTTP::Request::Form - Problem pressing input type=image button February 1, 2005, 7:56 am
Module to detect keyboard presses March 30, 2007, 8:09 am
HTTP::Proxy - how to detect start and end of URL fetch September 26, 2004, 6:00 am
Building module Encode::Detect on solaris 10 platform February 21, 2008, 9:13 am
Manipulating ANY type of email January 3, 2006, 5:03 pm
Ip address Data Type DBI May 10, 2006, 4:38 pm
Term::Cap -- Setting terminal type under Windows XP May 24, 2006, 1:46 pm
Term::Cap -- Setting terminal type under Windows XP May 29, 2006, 9:22 pm
[RFC] GD-Image-CopyIFS May 14, 2005, 3:42 pm

Our other projects:

Art Dolls, Fairies and Mermaids - Sunnyfaces.net

Roy's Linux, Programming and Search Engines messages

1-Script XML SitemapXML Sitemap