Re: Re: how to detect type of image

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 4/28/07, tedd <tedd@xxxxxxxxxxxx> wrote:
At 2:10 AM +0200 4/28/07, Tim wrote:
>On 21.04.2007 12:45, Alain Roger wrote:
>>Hi,
>>
>>In my web application, end user is able to load images (png, jpeg,
>>gif,..) into database. I would like to know how can i detect
>>automatically the type of image (pnd, jpeg,...) ? i do not want to
>>check the extension because this is easily faked... just by renaming
>>it.
>>
>>Does it exist a technique for that ?
>>
>>thanks a lot,
>>
>
>Hi,
>
>unfortunately mime_content_type() does not work for me.

Tim:

It should, but instead try this:

$image_size = getimagesize($filename);
echo $image_size['mime'];

Cheers,

tedd


mime_content_type fails a lot, and so does getimagesize, i believe one
relays on the other.

Tijnema

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


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux