note 59044 deleted from ref.array by felipe
| From: | felipe@php.net | Date: | Sun, 30 Dec 2007 19:22:56 +0000 |
| Subject: | note 59044 deleted from ref.array by felipe | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-134499@lists.php.net to get a copy of this message | ||
Note Submitter: madness AT l33t DOT it
----
A little function I like to use instead of the classic one, it lets me choose a better format an is
overall more versatile:
<?
function get_image_size($filename, &$imageinfo){
$rawdata=getimagesize($filename, $imageinfo);
$refineddata=$rawdata;
if ($rawdata){
$refineddata=$rawdata;
$refineddata['width']=$rawdata[0];
$refineddata['height']=$rawdata[1];
$refineddata['type']=$rawdata[2];
$refineddata['attribute']=" ".$rawdata[3];
$refineddata[4]=$rawdata['mime'];
}
return $refineddata;
}
?>
Notice I also added the extra space in the attribute field, becuase I usually use it like this:
<?
echo "<img src=\\"foo.jpg\\"".$imgdata[attribute]."
alt=\\"foo\\" />";
?>
This way if the attribute happens to be a null or empty value the tag doesn't contain double
spaces.