Re: how to detect type of image

From: Date: Sat, 21 Apr 2007 10:51:45 +0000
Subject: Re: how to detect type of image
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-253421@lists.php.net to get a copy of this message
On 4/21/07, Alain Roger <raf.news@gmail.com> 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, -- Alain
Use the mime_content_type function for returning the mime type. Check if that matches one of you image mimetypes http://www.php.net/mime_content_type Tijnema

« previous php.general (#253421) next »