note 98705 added to function.getimagesize
| From: | amigojackaddgmxdudenet at osu1 dot php dot net | Date: | Thu, 01 Jul 2010 20:33:03 +0000 |
| Subject: | note 98705 added to function.getimagesize | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-170638@lists.php.net to get a copy of this message | ||
> 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 ""
?>
----
Server IP: 212.124.37.9
Probable Submitter: 85.180.157.52
----
Manual Page -- http://www.php.net/manual/en/function.getimagesize.php
Edit -- https://master.php.net/note/edit/98705
Del: integrated -- https://master.php.net/note/delete/98705/integrated
Del: useless -- https://master.php.net/note/delete/98705/useless
Del: bad code -- https://master.php.net/note/delete/98705/bad+code
Del: spam -- https://master.php.net/note/delete/98705/spam
Del: non-english -- https://master.php.net/note/delete/98705/non-english
Del: in docs -- https://master.php.net/note/delete/98705/in+docs
Del: other reasons-- https://master.php.net/note/delete/98705
Reject -- https://master.php.net/note/reject/98705
Search -- https://master.php.net/manage/user-notes.php