Re: Returning image/gif Content-type

Sandy Kydd (
Fri, 07 Feb 1997 09:55:59 +0100

Message-Id: <>
Date: Fri, 07 Feb 1997 09:55:59 +0100
From: Sandy Kydd <>
Subject: Re: Returning image/gif Content-type

Rujith de Silva wrote:
> Did you remember to recompile gd using the fcgi .h files and libs?
> Otherwise, gd would just write to stdout, which is the WRONG thing to
> do, because fcgi works by intercepting writes to stdout.

According to the fcgi docs, you can use the FCGI_ToFILE macro to convert
an fcgi filestream to a Unix filestream. And they've redefined stdout in
fcgi_stdio.h to use their own filestream. So if I do 

	gdImageGif(im, FCGI_ToFILE(stdout));

I shouldn't have to recompile the gd library, right?

Anyway, if this doesn't work I'll try writing to a file first and then
chucking this back, which is possibly what I was going to do eventually,
as I was hoping to cache some of the generated gifs that might get used

> Is the app written in C, or in Perl using  There is another
> problem with using with fcgi that is more difficult to solve, but
> you shouldn't have a problem with combining gd and fcgi in C.

Its a C++ app. Being adventurous :-) Thanks to everyone who responded. I
haven't managed to get back to this yet, but hopefully I'll get it
working over the weekend.


Sandy Kydd <>