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

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.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.