View Full Version : Problem with saving PHP generated JPEG Images

01-23-2005, 08:10 AM

I'm having a problem with IE6 when it comes to images created by PHP using the ImageJPEG() function. The image is being created and displayed successfully, however when I try to save the picture, IE6 saves it in the .BMP format.

I'm setting the content type for the image using the function
header('Content-Type: image/jpeg');

When I right click the image and look at the properties, the type field has a value of "Not Available".

I have even tried ending the url with "&blank=.jpg" to see if that would do it!

Any help would be great!


01-23-2005, 10:37 AM
You have all the basics covered. When you try to save the image via right click do you get the option to save as more then one type? I can choose the orginal format i.e. .jpg or change it to .bmp. Check out this page. It uses the same php function you are trying and I can save as .jpg the images in the post. It also gives the code I am using.

Let me know if you can save the images there as .jpg.

01-23-2005, 03:19 PM

Thanks for that!

I have now narrowed the problem down to an include file which I'm using to check security / session details where I must be writing out a character unintentionally before the code executes

header("Content-type: image/jpeg");

Once I remove the include file everything works as it should.

Thanks again.


01-23-2005, 04:45 PM
Your welcome.

01-23-2005, 11:47 PM
This problem may not be what you think.

I had exactly the same symptom (jpg's would save only as .bmp's) off and on a couple of times. Each time it went away I thought I had done something to fix it, but nope: same fix didn't work twice.

Finally I found a useful tip on (ready for this?) the Microsoft knowledge base (seriously!).

The problem was simply too many Internet Temp files. I cleared the temp files (yes, there were a LOT of them) and it has worked perfectly since.

Worth a look, anyway. 8)