Correct me if I'm wrong, but you're outputting an image, correct?
header("Content-type: application/x-www-urlform-encoded");
Did you read what that says? A 'form' is not an image.. at all....
Not only that, but you can't simply assign an URL to a variable. Read up about opening a file (or URL) through [man]fopen[/man] and using [man]fpassthru[/man], NOT [man]passthru[/man].
Also, you could get the appropriate content type using [man]mime_content_type[/man] instead of hard-coding a specific image type (only if you're retrieving an image, not a '?MAP_SIZE' etc.)
GD library is in no way required to open file streams and output their data, regardless if they are images or not.