I think you can check phpinfo(), but another way mentioned by the PHP Manual is:
<?php
if (imagetypes() & IMG_GIF)
echo 'GIF support exists';
else
echo 'No GIF support';
?>
If there's no gif support, then use something else, like jpg or png that exists.
GD support exists, right?