mirror of
https://github.com/mosbth/cimage.git
synced 2025-08-26 17:14:27 +02:00
more test
This commit is contained in:
@@ -3,7 +3,6 @@
|
||||
* Fast track cache, read entries from the cache before processing image
|
||||
* the ordinary way.
|
||||
*/
|
||||
|
||||
// Load the config file or use defaults
|
||||
$configFile = __DIR__
|
||||
. "/"
|
||||
@@ -14,10 +13,23 @@ if (is_file($configFile) && is_readable($configFile)) {
|
||||
$config = require $configFile;
|
||||
} elseif (!isset($config)) {
|
||||
$config = array(
|
||||
"debug" => false,
|
||||
"autoloader" => __DIR__ . "/../autoload.php",
|
||||
"cache_path" => __DIR__ . "/../cache/",
|
||||
);
|
||||
}
|
||||
|
||||
// Debug mode needs additional functions
|
||||
if (CIMAGE_DEBUG) {
|
||||
require $config["autoloader"];
|
||||
}
|
||||
|
||||
// Cache path must be valid
|
||||
$cacheIsReadable = is_dir($config["cache_path"]) && is_readable($config["cache_path"]);
|
||||
if (!$cacheIsReadable) {
|
||||
die("imgf.php: Cache is not readable, check path in configfile.");
|
||||
}
|
||||
|
||||
// Prepare to check if fast cache should be used
|
||||
$cachePath = $config["cache_path"] . "/fasttrack";
|
||||
$query = $_GET;
|
||||
@@ -49,6 +61,9 @@ if ($useCache && is_readable($filename)) {
|
||||
if (isset($_SERVER["HTTP_IF_MODIFIED_SINCE"])
|
||||
&& strtotime($_SERVER["HTTP_IF_MODIFIED_SINCE"]) == $item["last-modified"]) {
|
||||
header("HTTP/1.0 304 Not Modified");
|
||||
if (CIMAGE_DEBUG) {
|
||||
trace("imgf 304");
|
||||
}
|
||||
exit;
|
||||
}
|
||||
|
||||
@@ -56,6 +71,9 @@ if ($useCache && is_readable($filename)) {
|
||||
header($value);
|
||||
}
|
||||
|
||||
if (CIMAGE_DEBUG) {
|
||||
trace("imgf 200");
|
||||
}
|
||||
readfile($item["source"]);
|
||||
exit;
|
||||
}
|
||||
|
Reference in New Issue
Block a user