added cache to the showAction to reduce network requests
This commit is contained in:
@@ -99,7 +99,9 @@ class FileController extends mfBaseController {
|
|||||||
|
|
||||||
$originalPath = MFUPLOAD_FILE_SAVE_PATH . ($file->subfolder ? "/{$file->subfolder}" : "") . "/{$file->store_filename}";
|
$originalPath = MFUPLOAD_FILE_SAVE_PATH . ($file->subfolder ? "/{$file->subfolder}" : "") . "/{$file->store_filename}";
|
||||||
if (!is_readable($originalPath)) self::sendError("Physical file not found");
|
if (!is_readable($originalPath)) self::sendError("Physical file not found");
|
||||||
|
header("Cache-Control: public, max-age=604800");
|
||||||
|
header("Expires: " . gmdate("D, d M Y H:i:s", time() + 604800) . " GMT");
|
||||||
|
header("Last-Modified: " . gmdate("D, d M Y H:i:s", filemtime($originalPath)) . " GMT");
|
||||||
|
|
||||||
$imageInfo = @getimagesize($originalPath);
|
$imageInfo = @getimagesize($originalPath);
|
||||||
|
|
||||||
@@ -140,4 +142,4 @@ class FileController extends mfBaseController {
|
|||||||
readfile($cachedPath);
|
readfile($cachedPath);
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user