Merge branch 'w18_MDL-26028_m23_xsendfile' of git://github.com/skodak/moodle
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user