-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathimages.php
More file actions
30 lines (22 loc) · 993 Bytes
/
images.php
File metadata and controls
30 lines (22 loc) · 993 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
<?php // $Id:,v 2.0 2012/05/20 16:10:00 Serafim Panov
require_once("../../config.php");
list($a, $req) = explode('images.php', $_SERVER['REQUEST_URI']);
$img = $CFG->dataroot.$req;
$fp = fopen($img, "r");
if ($fp) {
header("Cache-Control: private, max-age=10800, pre-check=10800");
header("Pragma: private");
header("Expires: " . date(DATE_RFC822,strtotime("30 day")));
if (isset($_SERVER['HTTP_IF_MODIFIED_SINCE']) && (strtotime($_SERVER['HTTP_IF_MODIFIED_SINCE']) == filemtime($img))) {
header('Last-Modified: '.gmdate('D, d M Y H:i:s', filemtime($img)).' GMT',
true, 304);
exit;
}
header("Content-type: image/jpeg");
header('Last-Modified: ' . gmdate('D, d M Y H:i:s', filemtime($img)) . ' GMT');
fpassthru($fp);
fclose($fp);
} else {
header("Content-type: application/octet-stream");
echo "File no found";
}