PHP.net says they recommend using imagecreatetruecolor over imagecreate. On the other hand, I've read elsewhere that imagecreate should be used to get more exact colors for GIFs. That turned out to be true when I tried it. The question is why should I use imagecreatetruecolor for JPGs and PNGs also? imagecreatetruecolor starts off with a black background I can't shake.
if (ereg("\.gif$", $name)) {
$target_id = imagecreate($dest_x, $dest_y);
}
else $target_id = imagecreatetruecolor($dest_x, $dest_y);
$white = imagecolorallocate($target_id, 255, 255, 255);
imagefill($target_id, 0, 0, $white);
$target_id always has a black background with JPGs and PNGs, but not GIFs. This is probably because "imagecreatetruecolor() returns an image identifier representing a black image of the specified size." But why wouldn't imagefill overwrite that?