[PHP] exif_imagetype and constant confusion

2008-06-19 Thread eric cash

Stupid question time!  I can't find my answer anywhere, sorry about this...

The nature of the return value of exif_imagetype() is baffling me.  The 
php manual uses one simple example like this:


code
   ?php
if (exif_imagetype('image.gif') != IMAGETYPE_GIF) {
   echo 'The picture is not a gif';
}
?

/code

okay, cool.  the return value is the constant IMAGETYPE_GIF.  of course 
if you do something like this: 


code
$foo = exif_imagetype('image.jpg');
echo $foo;
/code

you'll echo out 2.

Great, seems really useful to me.  What am I missing? Why is the value 
of the IMAGETYPE_XXX constants an integer, for one thing, and not a 
string like 'gif' or 'jpg'?  And how do I access some sort of usable 
string telling me the type of image without having to do something 
retarded like putting a bunch of strings in a numerically indexed array 
(which will be completely confusing later when I try to figure it out).  
And thirdly, what the !?#@ am I missing here? I feel like an idiot, but 
it makes no sense to me that an 'imagetype' function would return 
something that evaluates to an integer.


Please help, my head hurts.

Thanks

ec

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] GD brush tracing letters

2008-06-14 Thread eric cash
Quick GD question, I'm building a custom CAPTCHA, and I want to 'trace' 
random letters (hopefully from a random font) with a brush. Is there an 
easy way to do this, or am I going to have to build some ridiculous 
custom library on my own to do it?  Thanks!


ec

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php