PHP imagejpeg - MIME type in Safari on refresh
I have written a php script that generates a captcha image and gets called from my web form:
<img src="captcha.php?key=12345"></img>
The php script (the relevant part) looks like this. $image was correctly created earlier:
header('Content-Type: image/jpeg');
header('Cache-Control: no-cache');
header('Pragma: no-cache');
imagejpeg($image);
imagedestroy($image);
This works correctly in Firefox, but not in Safari. Well, most of the time... Sometimes (usually on the first load) safari works fine, but if I refresh the page, I get the following error in web inspector: Resource interpreted as image but transferred with MIME type text/php. Is this an apache setup issue or something in my code? Any suggestions on how to solve this would be greatly appreciated.
Here are the request and response headers:
Request:
Cache-Contr开发者_如何学Pythonol:max-age=0
Referer:http://www.fpcsd.org/invite.php
User-Agent:Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_7; en-us)
AppleWebKit/533.21.1 (KHTML, like Gecko) Version/5.0.5 Safari/533.21.1
Response:
Cache-Control:max-age=604800
Connection:keep-alive
Date:Mon, 06 Jun 2011 16:45:41 GMT
Expires:Mon, 13 Jun 2011 16:45:41 GMT
Server:nginx/0.7.65
X-Powered-By:PHP/5.3.3
精彩评论