[images] Use proper mime-type for displayable images.

This commit is contained in:
Solomon Peachy 2010-11-04 16:47:58 -04:00
parent 49946e684b
commit 178a0ffb4d
2 changed files with 7 additions and 1 deletions

View File

@ -8,6 +8,7 @@ For further information about Photo Organizer, see its web site at:
???? (Unreleased)
[fix] Mime type not set properly for images.
[fix] Spool controls not working on an empty folder.
[fix] URLs in the RSS feed were broken with pretty URLs enabled.

View File

@ -187,8 +187,12 @@ switch ($photo_data['access_rights']) {
# Another fixup.
if($image_type == 'jpg') $image_type = 'jpeg';
if(($image_type != 'jpeg') && ($image_type != 'png'))
if(($image_type != 'jpeg') && ($image_type != 'png')) {
$disposition = "attachment"; // can't display non-jpg/png in browser.
$mime_type = "application/octet-stream";
} else {
$mime_type = "image/$image_type";
}
header("Content-Disposition: $disposition; filename=$original_image_name; modification-date=\"$rfc1123\"; size=$file_length");
header("Last-Modified: $rfc1123");
@ -196,6 +200,7 @@ header("Last-Modified: $rfc1123");
/* Add an expires: header */
$expires = gmdate("r", (time() + 604800)) .' GMT'; /* 1 week */
header("Content-Type: $mime_type");
header("Expires: $expires");
if ($cache_ctrl != FALSE) {