0

I get this error while executing this code:

for( $iii = 0; $iii < $tot_layers; $iii++ )
	{
			$Lrow = mysql_fetch_array($Lresult); 
			if($HTTP_POST_VARS[$Lrow['name']] != 'spacer.gif')
			{
				if($nulavatar == false)
				{
					$sprite_1 = @$imagecreate($phpbb_root_path.$sprites_path.'/'.$HTTP_POST_VARS[$Lrow['name']]);
					$nulavatar = true;
				}
				else
				{
					$image = @$imagecreate($phpbb_root_path.$sprites_path.'/'.$HTTP_POST_VARS[$Lrow['name']]);
					@imagecopy ($sprite_1, $image, 0, 0, 0, 0, $tot_width, $tot_height);
					@ImageDestroy($image);
				}
			}
	}

	$save = $userdata['user_id'];
	imagepng($sprite_1, $phpbb_root_path . $chars_path . '/' . $save . '.png');
	imagedestroy($sprite_1);

i searched all over the net and i didnt find the solution, so please help me before i pull all of my hair out of my skull :D

2
Contributors
1
Reply
2
Views
6 Years
Discussion Span
Last Post by sDJh
0

when using imagecopy, you have to allocate the image before copying. In your case you copy it somewhere (hopefully PHP catches that bug!).

else
				{
//create your empty image here.
					$image = @$imagecreate($phpbb_root_path.$sprites_path.'/'.$HTTP_POST_VARS[$Lrow['name']]);
					@imagecopy ($sprite_1, $image, 0, 0, 0, 0, $tot_width, $tot_height);
					@ImageDestroy($image);
				}

this is all I can think of in the moment. TIP: Comment imagepng and remove all the @, so that you get a proper error report.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.