note 98705 deleted from function.getimagesize by danbrown
| From: | danbrown@php.net | Date: | Thu, 01 Jul 2010 20:40:41 +0000 |
| Subject: | note 98705 deleted from function.getimagesize by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-170639@lists.php.net to get a copy of this message | ||
Note Submitter: amigojack add gmx dude net
----
> to "spam at enrogue dot com" (15-Jan-2010 02:12) #95682:
Combining http://www.php.net/image_type_to_mime_type and
http://www.php.net/exif_imagetype the available
constants for all image types are these:
1 IMAGETYPE_GIF
2 IMAGETYPE_JPEG
3 IMAGETYPE_PNG
4 IMAGETYPE_SWF
5 IMAGETYPE_PSD
6 IMAGETYPE_BMP
7 IMAGETYPE_TIFF_II (intel byte order)
8 IMAGETYPE_TIFF_MM (motorola byte order)
9 IMAGETYPE_JPC
10 IMAGETYPE_JP2
11 IMAGETYPE_JPX
12 IMAGETYPE_JB2
13 IMAGETYPE_SWC
14 IMAGETYPE_IFF
15 IMAGETYPE_WBMP
16 IMAGETYPE_XBM
17 IMAGETYPE_ICO
_________________________________________
> to "@hill79" (18-Feb-2010 03:57) #96284:
Of course it can be optimized - have a look at the first two parameters to avoid all this text
replacing. Also watch out for a failing call:
<?php
function cssifysize( $sFile ) {
return ( $a= @getimagesize( $sFile ) )? $a[0]. 'px; '. $a[1]. 'px;':
'';
}
echo( cssifysize( 'images/1.jpg' ) );
// prints "127px; 160px;"
echo( cssifysize( 'images/does_not_exist.png' ) );
// prints ""
?>