mirror of
https://github.com/mosbth/cimage.git
synced 2025-01-17 02:58:15 +01:00
even more testing
This commit is contained in:
parent
493ed45311
commit
689865a8b2
@ -11,11 +11,11 @@ v0.7.13 (2016-08-08)
|
||||
* Moved functions from img.php to `functions.php`.
|
||||
* Added function `trace()` to measure speed and memory consumption, only for development.
|
||||
* Added fast cache #149.
|
||||
* Added `imgf.php` as shortcut to check for fast cache, before loading `img.php` as usual.
|
||||
* Added `imgf.php` as shortcut to check for fast cache, before loading `img.php` as usual, adding `imgf_config.php` as symlink to `img_config.php`.
|
||||
* Created `defines.php` and moved definition av version there.
|
||||
* Fixed images in README, #148.
|
||||
* Initiated dependency injection to `CImage`, class names can be set in config file and will be injected to `CImage` from `img.php`. Not implemented for all classes. #151.
|
||||
* Enabled debug mode to make it easeier to trace what actually happens while processing the image, #150.
|
||||
* Enabled debug mode to make it easier to trace what actually happens while processing the image, #150.
|
||||
|
||||
|
||||
v0.7.12 (2016-06-01)
|
||||
|
@ -4,9 +4,3 @@ define("CIMAGE_VERSION", "v0.7.13 (2016-08-08)");
|
||||
|
||||
// For CRemoteImage
|
||||
define("CIMAGE_USER_AGENT", "CImage/" . CIMAGE_VERSION);
|
||||
|
||||
// Change to true to enable debug mode which logs additional information
|
||||
// to file. Only use for test and development.
|
||||
define("CIMAGE_DEBUG", true);
|
||||
define("CIMAGE_DEBUG_FILE", "/tmp/cimage");
|
||||
//define("CIMAGE_DEBUG", false);
|
||||
|
@ -19,7 +19,8 @@ function trace($msg)
|
||||
return;
|
||||
}
|
||||
|
||||
$details = ":" . (string) round((microtime(true) - $_SERVER["REQUEST_TIME_FLOAT"]), 6) . "ms";
|
||||
$timer = number_format((microtime(true) - $_SERVER["REQUEST_TIME_FLOAT"]), 6);
|
||||
$details = "{$timer}ms";
|
||||
$details .= ":" . round(memory_get_peak_usage()/1024/1024, 3) . "MB";
|
||||
$details .= ":" . count(get_included_files());
|
||||
file_put_contents($file, "$details:$msg\n", FILE_APPEND);
|
||||
|
@ -20,6 +20,11 @@ if (is_file($configFile)) {
|
||||
$config = array();
|
||||
}
|
||||
|
||||
// Make CIMAGE_DEBUG false by default, if not already defined
|
||||
if (!defined("CIMAGE_DEBUG")) {
|
||||
define("CIMAGE_DEBUG", false);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
|
@ -5,6 +5,24 @@
|
||||
* config-file imgtest_config.php.
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Change to true to enable debug mode which logs additional information
|
||||
* to file. Only use for test and development. You must create the logfile
|
||||
* and make it writable by the webserver or log entries will silently fail.
|
||||
*
|
||||
* CIMAGE_DEBUG will be false by default, if its not defined.
|
||||
*/
|
||||
if (!defined("CIMAGE_DEBUG")) {
|
||||
//define("CIMAGE_DEBUG", false);
|
||||
define("CIMAGE_DEBUG", true);
|
||||
define("CIMAGE_DEBUG_FILE", "/tmp/cimage");
|
||||
}
|
||||
|
||||
|
||||
|
||||
return array(
|
||||
|
||||
/**
|
||||
@ -61,7 +79,7 @@ return array(
|
||||
* Default values:
|
||||
* fast_track_allow: false
|
||||
*/
|
||||
//'fast_track_allow' => true,
|
||||
'fast_track_allow' => true,
|
||||
|
||||
|
||||
|
||||
|
@ -43,12 +43,6 @@ define("CIMAGE_VERSION", "v0.7.13 (2016-08-08)");
|
||||
// For CRemoteImage
|
||||
define("CIMAGE_USER_AGENT", "CImage/" . CIMAGE_VERSION);
|
||||
|
||||
// Change to true to enable debug mode which logs additional information
|
||||
// to file. Only use for test and development.
|
||||
define("CIMAGE_DEBUG", true);
|
||||
define("CIMAGE_DEBUG_FILE", "/tmp/cimage");
|
||||
//define("CIMAGE_DEBUG", false);
|
||||
|
||||
|
||||
|
||||
/**
|
||||
@ -68,10 +62,11 @@ function trace($msg)
|
||||
{
|
||||
$file = CIMAGE_DEBUG_FILE;
|
||||
if (!is_writable($file)) {
|
||||
die("Using trace without a writable logfile. Create the file '$file' and make it writable for the web server.");
|
||||
return;
|
||||
}
|
||||
|
||||
$details = ":" . (string) round((microtime(true) - $_SERVER["REQUEST_TIME_FLOAT"]), 6) . "ms";
|
||||
$timer = number_format((microtime(true) - $_SERVER["REQUEST_TIME_FLOAT"]), 6);
|
||||
$details = "{$timer}ms";
|
||||
$details .= ":" . round(memory_get_peak_usage()/1024/1024, 3) . "MB";
|
||||
$details .= ":" . count(get_included_files());
|
||||
file_put_contents($file, "$details:$msg\n", FILE_APPEND);
|
||||
@ -4316,6 +4311,11 @@ if (is_file($configFile)) {
|
||||
$config = array();
|
||||
}
|
||||
|
||||
// Make CIMAGE_DEBUG false by default, if not already defined
|
||||
if (!defined("CIMAGE_DEBUG")) {
|
||||
define("CIMAGE_DEBUG", false);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
|
@ -13,12 +13,17 @@ if (is_file($configFile) && is_readable($configFile)) {
|
||||
$config = require $configFile;
|
||||
} elseif (!isset($config)) {
|
||||
$config = array(
|
||||
"debug" => false,
|
||||
"fast_track_allow" => true,
|
||||
"autoloader" => __DIR__ . "/../autoload.php",
|
||||
"cache_path" => __DIR__ . "/../cache/",
|
||||
);
|
||||
}
|
||||
|
||||
// Make CIMAGE_DEBUG false by default, if not already defined
|
||||
if (!defined("CIMAGE_DEBUG")) {
|
||||
define("CIMAGE_DEBUG", false);
|
||||
}
|
||||
|
||||
// Debug mode needs additional functions
|
||||
if (CIMAGE_DEBUG) {
|
||||
require $config["autoloader"];
|
||||
@ -37,6 +42,9 @@ $query = $_GET;
|
||||
// Do not use cache when no-cache is active
|
||||
$useCache = !(array_key_exists("no-cache", $query) || array_key_exists("nc", $query));
|
||||
|
||||
// Only use cache if enabled by configuration
|
||||
$useCache = $useCache && isset($config["fast_track_allow"]) && $config["fast_track_allow"] === true;
|
||||
|
||||
// Remove parts from querystring that should not be part of filename
|
||||
$clear = array("nc", "no-cache");
|
||||
foreach ($clear as $value) {
|
||||
|
1
webroot/imgf_config.php
Symbolic link
1
webroot/imgf_config.php
Symbolic link
@ -0,0 +1 @@
|
||||
img_config.php
|
@ -43,12 +43,6 @@ define("CIMAGE_VERSION", "v0.7.13 (2016-08-08)");
|
||||
// For CRemoteImage
|
||||
define("CIMAGE_USER_AGENT", "CImage/" . CIMAGE_VERSION);
|
||||
|
||||
// Change to true to enable debug mode which logs additional information
|
||||
// to file. Only use for test and development.
|
||||
define("CIMAGE_DEBUG", true);
|
||||
define("CIMAGE_DEBUG_FILE", "/tmp/cimage");
|
||||
//define("CIMAGE_DEBUG", false);
|
||||
|
||||
|
||||
|
||||
/**
|
||||
@ -68,10 +62,11 @@ function trace($msg)
|
||||
{
|
||||
$file = CIMAGE_DEBUG_FILE;
|
||||
if (!is_writable($file)) {
|
||||
die("Using trace without a writable logfile. Create the file '$file' and make it writable for the web server.");
|
||||
return;
|
||||
}
|
||||
|
||||
$details = ":" . (string) round((microtime(true) - $_SERVER["REQUEST_TIME_FLOAT"]), 6) . "ms";
|
||||
$timer = number_format((microtime(true) - $_SERVER["REQUEST_TIME_FLOAT"]), 6);
|
||||
$details = "{$timer}ms";
|
||||
$details .= ":" . round(memory_get_peak_usage()/1024/1024, 3) . "MB";
|
||||
$details .= ":" . count(get_included_files());
|
||||
file_put_contents($file, "$details:$msg\n", FILE_APPEND);
|
||||
@ -4316,6 +4311,11 @@ if (is_file($configFile)) {
|
||||
$config = array();
|
||||
}
|
||||
|
||||
// Make CIMAGE_DEBUG false by default, if not already defined
|
||||
if (!defined("CIMAGE_DEBUG")) {
|
||||
define("CIMAGE_DEBUG", false);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
|
File diff suppressed because one or more lines are too long
Loading…
x
Reference in New Issue
Block a user