Subject: | _image_type |
Date: | Fri, 6 Apr 2007 22:00:38 -0700 (PDT) |
To: | bug-GD [...] rt.cpan.org |
From: | Daxbert <daxbert [...] yahoo.com> |
I've come across a few .jpg/.jpeg images which do not have the
magic first four bytes required by _image_type() in Image.pm.PLS.
A sample distribution follows:
377 330 377 333 4
377 330 377 340 22701
377 330 377 341 771
377 330 377 342 16
377 330 377 354 1
377 330 377 355 2
377 330 377 376 3032
If appropriate, I would suggest the following patch below:
---------------------------------------------------------------------------------
--- GD/Image.pm.PLS.orig Fri Apr 6 21:50:20 2007
+++ GD/Image.pm.PLS Fri Apr 6 21:51:45 2007
@@ -171,9 +171,7 @@
my $data = shift;
my $magic = substr($data,0,4);
return 'Png' if $magic eq "\x89PNG";
- return 'Jpeg' if $magic eq "\377\330\377\340";
- return 'Jpeg' if $magic eq "\377\330\377\341";
- return 'Jpeg' if $magic eq "\377\330\377\356";
+ return 'Jpeg' if substr($data,0,3) eq "\377\330\377";
return 'Gif' if $magic eq "GIF8";
return 'Gd2' if $magic eq "gd2\000";
return 'Xpm' if substr($data,0,9) eq "/* XPM */";
Show quoted text
____________________________________________________________________________________
Be a PS3 game guru.
Get your game face on with the latest PS3 news and previews at Yahoo! Games.
http://videogames.yahoo.com/platform?platform=120121