How to avoid 'Cannot redeclare class' error?

I use Image extension( to resize multiple images from a html form in a loop

		$image = Yii::app()->image->load($ori_dir.$file);





and I encountered:

Fatal error: Cannot redeclare class Image_GD_Driver in PATH_TO\GD.php on line 380

How to deal with this? Thanks.

Solved:change ‘include’ in line 123 in GD.php to ‘include_once’ helps.

Don’t know why the author used include.

include is faster then include_once, the latter will check if file has been included so this checking will cost some time ,but in loop or recursion scenario “include” may bring some trouble as you met :lol: