Image

Imagekriona wrote in Imagephp 😊contemplative

Confusion

I'm writing my own forum so I can learn PHP.

$total_smilies = count($smilies);
for($i=0;$i<$total_smilies;$i++) {

	$path = ($lvl . "images/smilies/" . $smilies[$i]['icon']);

	if(file_exists($path)) {

		$size = getimagesize($path);

		...

	}

} // end for


Now, this code works fine. I'm using getimagesize so I know the dimensions of the smilie icon. However, when I change the code to this:

$total_smilies = count($smilies);
for($i=0;$i<$total_smilies;$i++) {

	$path = ($lvl . "images/smilies/" . $smilies[$i]['icon']);

	if(file_exists($path)) {

		$size = getimagesize($path);

		...

	}

	$smilies[$i] = "";

} // end for


I get: Warning: getimagesize() [function.getimagesize]: Read error!

After I finished writing my forum, I decided to download another and compare to see how I could do it better (phpBB-2.0.6), and they undeclare arrays like that to save on memory. Explainations?