Necmettin,
There is really no way of using GD in PHP to play with the GIF format. GIF support is now deprecated(sp?) as it was dropped by the GD crowd due to licensing restrictions Unisys, the owner's of the GIF compression algorithm, have imposed upon it's usage. Unisys are going the way of Microsoft, they are threatening to sue every website using GIF images which hasn't paid them a licensing fee. That obviously does jive with Open Source community so we've moved on to other options...... PNG's are actaully just as compact and offer better resolution anyways.
PHP extensions are compiled against a specific version so an extension compiled for 4.0.5 won't work with 4.0.4 or 4.0.6, for example. I forget the exact version where PHP moved to the JPEG/PNG support version of GD, but the GD version number where the switch was made was 1.6.2. To use GIF, you're tying yourself to an old PHP version with no hope of updates unless you want to custom hack it everytime. I'd suggest you move to JPEG's and PNG's unless it's going to cause a huge amount of re-coding (and you don't mind paying Unisys for a GIF license). HTH,
Cheers,
Geoff A. Virgo