Forum How do I...?

GET gif image not rendered

I am trying to display a image from a database source in a pdf.

I GET the image using the tag:
<img src="http://<servername>/download.aspx?guid=<someguid>" alt="alt text"/> 

'download.aspx' returns the image in the response using BinaryWrite() including the content type in the header (retrieved from the db).

The pdf displays JPGs correctly however GIFs display the alt text.

Other GIF appear in the document using
<img src="<servername>/image.gif" />

Any suggestions to solve this/explain wrong appreciated.

Are any warning or error messages appearing in the Prince output log? Can you try downloading the GIF image using wget or curl and verify that it is coming back with the correct Content-Type header?
The log displays the line:
Mon Nov  2 09:04:13 2009: http://<servername>/download.aspx?guid=xxxxxxxx-xxxx-4c8c-ae83-87cab308244e: warning: Could not load GIF file

I've checked the Content-Type being returned as 'image/gif' and 'image/jpeg' for nonworking and working images respectively.

I'm looking into this now. Any leads?
Sounds like it's an issue with the image, rather than the HTTP request. Can you try saving the image as a local file and see if Prince can successfully load it that way?
Prince successfully loads image types when tags using
<img src="http://<servername>/test_jpg.jpg" />
<img src="http://<servername>/test_gif.gif" />
<img src="http://<servername>/test_jpeg.jpeg" />
Okay, so HTTP is working. But that's a different GIF file, right?
I've tried multiple different gif and jpeg files with the same results.

I initially thought it was a corrupt image but the same things happened with different gifs.
So it's not a problem with HTTP, and it's not a problem with the GIF images. The problem only occurs when the images are retrieved via the download.aspx page. Presumably they display fine in the web browser when this URL is viewed? The one thing I can think of is that perhaps they are using a Content-Transfer-Encoding that Prince doesn't handle properly, but I'm surprised there is no error message.

We can debug the HTTP request by running "curl -v URL". Is this a publicly accessible URL? If so, it would be great if you could email it to me (, then we could try it here.
You're right. Images are displaying onscreen without issue.
Unfortunately I'm unable to provide you with a public url.

I'll have a look into the Content-Transfer-Encoding and post back with results if any a solution is found.

Thanks for the assistance.

I found the issue. Not associated with Prince at all.

While save images to the database a re-size occurs which changed the formatting to jpeg without changing the MIME being save.

Sorry for the time wasting and thanks again.

No problem, glad to hear it's all sorted out! :)
Prince 8.0 now tries harder to load images that are incorrectly assigned the wrong MIME type, which should solve this issue.