Is it possible to load an entire gif with PHP?

header("Content-type: image/gif");
$im = imagecreatefromgif("ani.gif");
header("Content-Type: image/gif");
imagegif($im);
imagedestroy($im);

^ I've tried the following but it only loads the first frame.