You are here: Re: check for jpg and gif without Zend? « PHP Programming Language « IT news, forums, messages
Re: check for jpg and gif without Zend?

Posted by Krustov on 11/25/06 18:31

<comp.lang.php>
<Geoff>
<25 Nov 2006 09:54:57 -0800>
<1164477297.043679.294490@h54g2000cwb.googlegroups.com>

> Previously I was able to check for an uploaded file to be a jpg or a
> gif by using the exif_imagetype() function.
>
> I had to change from hosting provider and the new one doesn't want to
> enable Zend on their php.
>
> I would like to have a way to check for a file to be a jpg or gif file
> in another way.
>

<?php

$logo="demo/whatever.jpg";

$logosize=getimagesize($logo);

print $logosize[2];

?>


$logosize[2];

If it prints a 2 then its a .jpg file - cant remember what 0 , 1 , 3 ,
etc stand for .


[0] is the width
[1] is the height
[2] is the image type
[3] is the width and height


<img src="<?php print $logo; ?>" width="<?php print $logosize[0]; ?>"
height="<?php print $logosize[1]; ?>" border="0" alt="">

As your grabbing the image info anyway - its usually a good idea to use
the width and height stuff as it saves the webpage from jumping all over
the place .


--
www.phpwhois.co.uk

 

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

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