paniwani Posted August 7, 2008 Share Posted August 7, 2008 My site dynamically creates a jpeg image using the GD library and I access the image through an <img> tag inside the main page. My problem is that when I try to right click on and save the image in internet explorer, the file is saved as a .bmp file instead of .jpeg. Firefox and opera both correctly save as .jpeg. I think this might be an issue of using the right headers, but I'm not sure how they work exactly. Right now, these are the headers on my image page: header("Content-Type: image/jpeg"); header("Content-Disposition: inline; filename=graphicschedule;"); How do I get IE to save the file correctly as a jpeg? Thanks in advance. Link to comment https://forums.phpfreaks.com/topic/118580-gd-library-saving-images-in-ie/ Share on other sites More sharing options...
ratcateme Posted August 7, 2008 Share Posted August 7, 2008 i am not sure but adding a .jpeg ext onto the file name might help Scott. Link to comment https://forums.phpfreaks.com/topic/118580-gd-library-saving-images-in-ie/#findComment-610487 Share on other sites More sharing options...
PFMaBiSmAd Posted August 7, 2008 Share Posted August 7, 2008 The file name also needs quotes around it and no semi-colon at the end. Untested (I am not sure this will fix your problem, but it corrects the syntax) - header('Content-Disposition: inline; filename="graphicschedule.jpg"'); Link to comment https://forums.phpfreaks.com/topic/118580-gd-library-saving-images-in-ie/#findComment-610638 Share on other sites More sharing options...
paniwani Posted August 8, 2008 Author Share Posted August 8, 2008 Thanks for the advice guys. I read online that in order for IE to display the .jpeg properly I had to utilize the cache. Now as far as I know, that means the user will download a local copy of the web page to their hard drive so they can access it quicker next time. Can anyone explain why IE needed that or just explain cache better? Here's my working code: header("Content-Type: image/jpeg"); header('Content-Disposition: inline; filename="graphicschedule.jpg"'); session_cache_limiter('public'); also, in my image tag i added a random number suffix to the page so it would cache a different page each time: echo "<img src='image.php/" . mt_rand(1,100000) . "'>"; Link to comment https://forums.phpfreaks.com/topic/118580-gd-library-saving-images-in-ie/#findComment-611244 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.