note 59044 deleted from ref.array by felipe

[email protected]
Newsgroups php.notes
Message-ID <[email protected]>
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.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.