Merge branch 'w18_MDL-26028_m23_xsendfile' of git://github.com/skodak/moodle

This commit is contained in:
Sam Hemelryk
2012-05-02 11:48:24 +12:00
15 changed files with 355 additions and 314 deletions
+7
View File
@@ -139,6 +139,9 @@ if ($rev > -1) {
// parameters to get the best performance.
function send_cached_image($imagepath, $rev) {
global $CFG;
require("$CFG->dirroot/lib/xsendfilelib.php");
$lifetime = 60*60*24*30; // 30 days
$pathinfo = pathinfo($imagepath);
$imagename = $pathinfo['filename'].'.'.$pathinfo['extension'];
@@ -155,6 +158,10 @@ function send_cached_image($imagepath, $rev) {
header('Content-Type: '.$mimetype);
header('Content-Length: '.filesize($imagepath));
if (xsendfile($imagepath)) {
die;
}
// no need to gzip already compressed images ;-)
readfile($imagepath);