trying to pull in an image from file which has a white background make the white transparent and copy it onto a new image with a black background, the script below below works except for making the background transparent, anyone got any ideas??

thanks in advance

$image = ImageCreateFromgif("square.gif"); //the image pulled in from a gif
$white = ImageColorAllocate($image, 255, 255, 255);
ImageColorTransparent($image, $white);

$vir_image = ImageCreate(300,300); //the new virtual image
$black = ImageColorAllocate($vir_image, 0, 0, 0);

ImageCopy ($vir_image, $image, 50, 50, 0, 0, 100, 100);
//Copy a part of vir_image onto image - starting at the position x,y - from x,y on vir_image to x,y.