Edit the php.ini file. If you search through the extensions section, add the following line:
extension=php_gd.dll
if there is a # in front, ie
#extension=php_gd.dll
remove the # in front of the line.
If the extension directory directive is correctly set and the file php_gd.dll is in this directory, your script should work.
Hope this helps.