$textcolor = imagecolorallocate($img_number,255,255,255); if there was no $textcolor the php code won't work