We recently introduced Amazon S3 on our site, so we've changed the way we process images. We used the controller call /fotos.php, which would read the file from disk, write statistics, set headers and return the contents of the file as image / jpeg.
Everything went fine until S3. Fotos.php now redirects 302 to a resource in Amazon, and everything works fine, but you cannot save the image in Firefox because it sets its file type to .htm. I found this discussion on this, and it seems like a bug in Firefox:
https://bugs.launchpad.net/ubuntu/+source/firefox-3.0/+bug/207670
The following is the URL of the problem (try saving a large 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 code snippet 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 MYH: 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 also use CloudFront.
source
share