Re: [PHP] Re: how to detect type of image

2007-04-29 Thread tedd
At 4:46 PM -0500 4/28/07, Edward Vermillion wrote: On Apr 28, 2007, at 12:21 PM, tedd wrote: At 9:22 AM -0500 4/28/07, Edward Vermillion wrote: It should, but instead try this: $image_size = getimagesize($filename); echo $image_size['mime']; $image_size['mime'] ? Where did that come from?

Re: [PHP] Re: how to detect type of image

2007-04-29 Thread Edward Vermillion
On Apr 29, 2007, at 8:03 AM, tedd wrote: At 4:46 PM -0500 4/28/07, Edward Vermillion wrote: On Apr 28, 2007, at 12:21 PM, tedd wrote: At 9:22 AM -0500 4/28/07, Edward Vermillion wrote: It should, but instead try this: $image_size = getimagesize($filename); echo $image_size['mime'];

Re: [PHP] Re: how to detect type of image

2007-04-29 Thread tedd
At 9:53 AM -0500 4/29/07, Edward Vermillion wrote: On Apr 29, 2007, at 8:03 AM, tedd wrote: The php functions that provide data about files, do just that. They inspect the header of the file and report what they have found. How you use them, is your business. Well, from the example it

Re: [PHP] Re: how to detect type of image

2007-04-28 Thread Tijnema !
On 4/28/07, Tim [EMAIL PROTECTED] 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

[PHP] Re: how to detect type of image

2007-04-28 Thread tedd
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

Re: [PHP] Re: how to detect type of image

2007-04-28 Thread Tijnema !
On 4/28/07, tedd [EMAIL PROTECTED] 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,

Re: [PHP] Re: how to detect type of image

2007-04-28 Thread Edward Vermillion
On Apr 28, 2007, at 6:54 AM, tedd 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,

Re: [PHP] Re: how to detect type of image

2007-04-28 Thread Tijnema !
On 4/28/07, Edward Vermillion [EMAIL PROTECTED] wrote: On Apr 28, 2007, at 6:54 AM, tedd 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

Re: [PHP] Re: how to detect type of image

2007-04-28 Thread tedd
At 9:22 AM -0500 4/28/07, Edward Vermillion wrote: It should, but instead try this: $image_size = getimagesize($filename); echo $image_size['mime']; $image_size['mime'] ? Where did that come from? I duno, maybe the manual. http://us2.php.net/getimagesize -- 5th or 6th example down.

Re: [PHP] Re: how to detect type of image

2007-04-28 Thread Tim
On 28.04.2007 10:39, Tijnema ! wrote: First of all, i don't see any reason why this works better then other functions, as it also relies on the magic bytes. Second, for your switch, you should use the constants (IMAGETYPE_GIF,IMAGETYPE_JPEG,...) instead of just using decimal values. Tijnema

[PHP] Re: how to detect type of image

2007-04-28 Thread Al
If it's critical that you can detect the image type accurately, I'd suggest using ImageMagick's identify command. It will tell you about everything that you'd ever want to know about an image. http://www.imagemagick.org/script/index.php Post your question on their forum

Re: [PHP] Re: how to detect type of image

2007-04-28 Thread Edward Vermillion
On Apr 28, 2007, at 12:21 PM, tedd wrote: At 9:22 AM -0500 4/28/07, Edward Vermillion wrote: It should, but instead try this: $image_size = getimagesize($filename); echo $image_size['mime']; $image_size['mime'] ? Where did that come from? I duno, maybe the manual.

Re: [PHP] Re: how to detect type of image

2007-04-25 Thread Satyam
: how to detect type of image On Sun, April 22, 2007 10:35 am, Jonathan wrote: 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

Re: [PHP] Re: how to detect type of image

2007-04-25 Thread Tijnema !
. - Original Message - From: Richard Lynch [EMAIL PROTECTED] To: Jonathan [EMAIL PROTECTED] Cc: php-general@lists.php.net Sent: Wednesday, April 25, 2007 4:30 AM Subject: Re: [PHP] Re: how to detect type of image On Sun, April 22, 2007 10:35 am, Jonathan wrote: Alain Roger wrote: Hi, In my web

Re: [PHP] Re: how to detect type of image

2007-04-25 Thread Richard Davey
Tijnema ! wrote: I believe that mime_content_type does this, by reading a .magic file. In a magic file, there are these described i believe. But how would you detect (by a magic number) if a script is HTML or PHP? No way :P mime_content_type is deprecated, use the FileInfo functions instead.

Re: [PHP] Re: how to detect type of image WAY OT (but not that far)

2007-04-25 Thread Børge Holen
On Wednesday 25 April 2007 14:14, Richard Davey wrote: Tijnema ! wrote: I believe that mime_content_type does this, by reading a .magic file. In a magic file, there are these described i believe. But how would you detect (by a magic number) if a script is HTML or PHP? No way :P

Re: [PHP] Re: how to detect type of image

2007-04-25 Thread Richard Lynch
On Wed, April 25, 2007 2:51 am, Satyam wrote: Sorry I'm late to this thread, I don't know if it has been mentioned, but most files have a 'magic number' at the begining of the file, which usually reads as a couple of letters or more. I think EXE files start with MZ, gifs with GIFxx where

Re: [PHP] Re: how to detect type of image

2007-04-25 Thread Richard Lynch
On Wed, April 25, 2007 7:00 am, Tijnema ! wrote: On 4/25/07, Satyam [EMAIL PROTECTED] wrote: Sorry I'm late to this thread, I don't know if it has been mentioned, but most files have a 'magic number' at the begining of the file, which usually reads as a couple of letters or more. I think

Re: [PHP] Re: how to detect type of image

2007-04-24 Thread Richard Lynch
On Sun, April 22, 2007 10:35 am, Jonathan wrote: 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

Re: [PHP] Re: how to detect type of image

2007-04-24 Thread Richard Lynch
On Sun, April 22, 2007 12:14 pm, Tijnema ! wrote: Yeah right, a time bomb with an image header :P It should have an ELF header :) But then it would be detected by the mime_content_type i guess. mime_content_type would not detect, say, a PHP script embedded into the comments section of a JPEG

[PHP] Re: how to detect type of image

2007-04-22 Thread Jonathan
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.

Re: [PHP] Re: how to detect type of image

2007-04-22 Thread Myron Turner
Jonathan wrote: 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...

Re: [PHP] Re: how to detect type of image

2007-04-22 Thread Børge Holen
On Sunday 22 April 2007 17:35, Jonathan wrote: 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

Re: [PHP] Re: how to detect type of image

2007-04-22 Thread Tijnema !
On 4/22/07, Myron Turner [EMAIL PROTECTED] wrote: Jonathan wrote: 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

[PHP] Re: how to detect type of image

2007-04-21 Thread zerof
Alain Roger escreveu: 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.