1
0
mirror of https://github.com/mosbth/cimage.git synced 2025-08-05 07:37:37 +02:00

intermediate

This commit is contained in:
Mikael Roos
2015-12-11 10:07:16 +01:00
parent 276f46fce2
commit cf2fc3de4f
4 changed files with 24 additions and 9 deletions

View File

@@ -12,6 +12,12 @@ v0.8.* (2015-12-05) (branch resize)
* Require PHP 5.4. * Require PHP 5.4.
v0.7.9* (2015-12-07)
-------------------------------------
* Fix strict mode only reporting 404 when failure, #127.
v0.7.9 (2015-12-07) v0.7.9 (2015-12-07)
------------------------------------- -------------------------------------

View File

@@ -2542,8 +2542,10 @@ class CImage
$this->log("Output format is: $format"); $this->log("Output format is: $format");
if (!$this->verbose && $format == 'json') { if (!$this->verbose && $format == 'json') {
header('Content-type: application/json'); #header('Content-type: application/json');
echo $this->json($file); #echo $this->json($file);
return serialize(["hello", 1]);
#return;
exit; exit;
} elseif ($format == 'ascii') { } elseif ($format == 'ascii') {
header('Content-type: text/plain'); header('Content-type: text/plain');

View File

@@ -5,5 +5,10 @@
*/ */
require __DIR__ . "/../autoload.php"; require __DIR__ . "/../autoload.php";
define('IMAGE_PATH', __DIR__ . '/../webroot/img/'); if (!defined("IMAGE_PATH")) {
define('CACHE_PATH', __DIR__ . '/../cache/'); define("IMAGE_PATH", __DIR__ . "/../webroot/img/");
}
if (!defined("CACHE_PATH")) {
define("CACHE_PATH", __DIR__ . "/../cache/");
}

View File

@@ -38,16 +38,16 @@ function errorPage($msg, $type = 500)
$header = "500 Internal Server Error"; $header = "500 Internal Server Error";
} }
if ($mode == "strict") {
$header = "404 Not Found";
}
header("HTTP/1.0 $header"); header("HTTP/1.0 $header");
if ($mode == "development") { if ($mode == "development") {
die("[img.php] $msg"); die("[img.php] $msg");
} }
if ($mode == "strict") {
$header = "404 Not Found";
}
error_log("[img.php] $msg"); error_log("[img.php] $msg");
die("HTTP/1.0 $header"); die("HTTP/1.0 $header");
} }
@@ -1177,7 +1177,7 @@ EOD;
/** /**
* Load, process and output the image * Load, process and output the image
*/ */
$img->log("Incoming arguments: " . print_r(verbose(), 1)) $res = $img->log("Incoming arguments: " . print_r(verbose(), 1))
->setSaveFolder($cachePath) ->setSaveFolder($cachePath)
->useCache($useCache) ->useCache($useCache)
->setSource($srcImage, $imagePath) ->setSource($srcImage, $imagePath)
@@ -1233,3 +1233,5 @@ $img->log("Incoming arguments: " . print_r(verbose(), 1))
->save() ->save()
->linkToCacheFile($aliasTarget) ->linkToCacheFile($aliasTarget)
->output(); ->output();
return $res;