Hi!
We've recently implemented Amazon S3 in our site which led us to change the way we handled images. We used to call a controller /fotos.php that would read the file from disk, record some statistics, set headers and return the contents of the file as image/jpeg.
All went OK until S3. Fotos.php now does a 302 redirect to the resource in Amazon and all is nice and working, but you can't save a image in Firefox because it sets its file type as .htm. I found this discussion on the matter, and it seems like a bug in Firefox:
https://bugs.launchpad.net/ubuntu/+source/firefox-3.0/+bug/207670
Here is a URL exhibiting the problem (try to save the big image):
http://www.viajeros.com/fotos/el-gran-lago-de-atitlan-y-sus-volcanes/132968
Internet Explorer 6 at least tries to save it as Untitled.BMP.
Here is the snippet of code we use in fotos.php:
$archivo = $fotos->ObtenerPathFotoAmazon( $url, null ); if (empty($_GET['nocache'])) { header('HTTP/1.0 302 Found'); header("Expires: ".gmdate("D, d M Y H:i:s", time()+315360000)." GMT"); header("Cache-Control: max-age=315360000"); } else { header('HTTP/1.0 307 Temporary Redirect'); } header('Location: ' . AWS_BUCKET_URL . $archivo); die;
Do you know a workaround for this?
EDIT: We are using CloudFront as well.