You should use setImageDispose method to clear the frame area:
$frame->readImage($_FILES["image$i"]);
$frame->setImageDispose(2);
$frame->setImageDelay(100);
- Undefined: 0 -> No disposal specified (equivalent to 'none').
- None: 1 -> Do not dispose, just overlay next frame image.
- Background: 2 -> Clear the frame area with the background color.
- Previous: 3 -> Clear to the image prior to this frames overlay.
And you could add a call to 'optimizeImageLayers' to reduce the size of your file:
$GIF->optimizeImageLayers();
$GIF->writeImages("C:\wamp\www\latest\im\allimage.gif" , true);