You are here: Re: Validate an image type using php « PHP Programming Language « IT news, forums, messages
Re: Validate an image type using php

Posted by Lorenzo Thurman on 11/20/06 17:51

Pedro Graca wrote:
> Lorenzo Thurman wrote:
>> Does anyone know how to validate a particular image type using PHP? If I
>> have a file and I want to ensure that it is a jpeg, how would go about
>> it? A sort of is_jpeg or is_gif is what I'm seeking.
>
> http://www.php.net/getimagesize
>
> Not tested
>
> <?php
> $image_data = getimagesize('whatever') or die('Unable to check
> image.');
> if ($image_data[2] == 2) {
> echo 'File is an image of type JPG.';
> } else {
> echo 'File is not an image or, if it\'s an image, it\'s not of type JPG';
> }
> ?>
>
Thanks for the reply, but do you know where I can get this info for
other types?

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация