mirror of
https://github.com/mosbth/cimage.git
synced 2025-07-27 03:30:13 +02:00
generated new bundles
This commit is contained in:
125
webroot/imgd.php
125
webroot/imgd.php
@@ -982,6 +982,13 @@ class CImage
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add HTTP headers for outputing image.
|
||||||
|
*/
|
||||||
|
private $HTTPHeader = array();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Default background color, red, green, blue, alpha.
|
* Default background color, red, green, blue, alpha.
|
||||||
*
|
*
|
||||||
@@ -3341,11 +3348,28 @@ class CImage
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add HTTP header for putputting together with image.
|
||||||
|
*
|
||||||
|
* @param string $type the header type such as "Cache-Control"
|
||||||
|
* @param string $value the value to use
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function addHTTPHeader($type, $value)
|
||||||
|
{
|
||||||
|
$this->HTTPHeader[$type] = $value;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Output image to browser using caching.
|
* Output image to browser using caching.
|
||||||
*
|
*
|
||||||
* @param string $file to read and output, default is to use $this->cacheFileName
|
* @param string $file to read and output, default is to
|
||||||
* @param string $format set to json to output file as json object with details
|
* use $this->cacheFileName
|
||||||
|
* @param string $format set to json to output file as json
|
||||||
|
* object with details
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
@@ -3382,6 +3406,10 @@ class CImage
|
|||||||
header('Last-Modified: ' . $gmdate . " GMT");
|
header('Last-Modified: ' . $gmdate . " GMT");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
foreach($this->HTTPHeader as $key => $val) {
|
||||||
|
header("$key: $val");
|
||||||
|
}
|
||||||
|
|
||||||
if (isset($_SERVER['HTTP_IF_MODIFIED_SINCE']) && strtotime($_SERVER['HTTP_IF_MODIFIED_SINCE']) == $lastModified) {
|
if (isset($_SERVER['HTTP_IF_MODIFIED_SINCE']) && strtotime($_SERVER['HTTP_IF_MODIFIED_SINCE']) == $lastModified) {
|
||||||
|
|
||||||
if ($this->verbose) {
|
if ($this->verbose) {
|
||||||
@@ -3606,7 +3634,7 @@ EOD;
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
$version = "v0.7.6* (2015-10-18)";
|
$version = "v0.7.7 (2015-10-21)";
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -4247,11 +4275,16 @@ verbose("use cache = $useCache");
|
|||||||
* quality, q - set level of quality for jpeg images
|
* quality, q - set level of quality for jpeg images
|
||||||
*/
|
*/
|
||||||
$quality = get(array('quality', 'q'));
|
$quality = get(array('quality', 'q'));
|
||||||
|
$qualityDefault = getConfig('jpg_quality', null);
|
||||||
|
|
||||||
is_null($quality)
|
is_null($quality)
|
||||||
or ($quality > 0 and $quality <= 100)
|
or ($quality > 0 and $quality <= 100)
|
||||||
or errorPage('Quality out of range');
|
or errorPage('Quality out of range');
|
||||||
|
|
||||||
|
if (is_null($quality) && !is_null($qualityDefault)) {
|
||||||
|
$quality = $qualityDefault;
|
||||||
|
}
|
||||||
|
|
||||||
verbose("quality = $quality");
|
verbose("quality = $quality");
|
||||||
|
|
||||||
|
|
||||||
@@ -4260,12 +4293,16 @@ verbose("quality = $quality");
|
|||||||
* compress, co - what strategy to use when compressing png images
|
* compress, co - what strategy to use when compressing png images
|
||||||
*/
|
*/
|
||||||
$compress = get(array('compress', 'co'));
|
$compress = get(array('compress', 'co'));
|
||||||
|
$compressDefault = getConfig('png_compression', null);
|
||||||
|
|
||||||
is_null($compress)
|
is_null($compress)
|
||||||
or ($compress > 0 and $compress <= 9)
|
or ($compress > 0 and $compress <= 9)
|
||||||
or errorPage('Compress out of range');
|
or errorPage('Compress out of range');
|
||||||
|
|
||||||
|
if (is_null($compress) && !is_null($compressDefault)) {
|
||||||
|
$compress = $compressDefault;
|
||||||
|
}
|
||||||
|
|
||||||
verbose("compress = $compress");
|
verbose("compress = $compress");
|
||||||
|
|
||||||
|
|
||||||
@@ -4517,6 +4554,18 @@ $cachePath = getConfig('cache_path', __DIR__ . '/../cache/');
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the cachepath from config.
|
||||||
|
*/
|
||||||
|
$cacheControl = getConfig('cache_control', null);
|
||||||
|
|
||||||
|
if ($cacheControl) {
|
||||||
|
verbose("cacheControl = $cacheControl");
|
||||||
|
$img->addHTTPHeader("Cache-Control", $cacheControl);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Prepare a dummy image and use it as source image.
|
* Prepare a dummy image and use it as source image.
|
||||||
*/
|
*/
|
||||||
@@ -4586,6 +4635,65 @@ EOD;
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Log verbose details to file
|
||||||
|
*/
|
||||||
|
if ($verboseFile) {
|
||||||
|
$img->setVerboseToFile("$cachePath/log.txt");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Hook after img.php configuration and before processing with CImage
|
||||||
|
*/
|
||||||
|
$hookBeforeCImage = getConfig('hook_before_CImage', null);
|
||||||
|
|
||||||
|
if (is_callable($hookBeforeCImage)) {
|
||||||
|
verbose("hookBeforeCImage activated");
|
||||||
|
|
||||||
|
$allConfig = $hookBeforeCImage($img, array(
|
||||||
|
// Options for calculate dimensions
|
||||||
|
'newWidth' => $newWidth,
|
||||||
|
'newHeight' => $newHeight,
|
||||||
|
'aspectRatio' => $aspectRatio,
|
||||||
|
'keepRatio' => $keepRatio,
|
||||||
|
'cropToFit' => $cropToFit,
|
||||||
|
'fillToFit' => $fillToFit,
|
||||||
|
'crop' => $crop,
|
||||||
|
'area' => $area,
|
||||||
|
'upscale' => $upscale,
|
||||||
|
|
||||||
|
// Pre-processing, before resizing is done
|
||||||
|
'scale' => $scale,
|
||||||
|
'rotateBefore' => $rotateBefore,
|
||||||
|
'autoRotate' => $autoRotate,
|
||||||
|
|
||||||
|
// General processing options
|
||||||
|
'bgColor' => $bgColor,
|
||||||
|
|
||||||
|
// Post-processing, after resizing is done
|
||||||
|
'palette' => $palette,
|
||||||
|
'filters' => $filters,
|
||||||
|
'sharpen' => $sharpen,
|
||||||
|
'emboss' => $emboss,
|
||||||
|
'blur' => $blur,
|
||||||
|
'convolve' => $convolve,
|
||||||
|
'rotateAfter' => $rotateAfter,
|
||||||
|
|
||||||
|
// Output format
|
||||||
|
'outputFormat' => $outputFormat,
|
||||||
|
'dpr' => $dpr,
|
||||||
|
|
||||||
|
// Other
|
||||||
|
'postProcessing' => $postProcessing,
|
||||||
|
));
|
||||||
|
verbose(print_r($allConfig, 1));
|
||||||
|
extract($allConfig);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Display image if verbose mode
|
* Display image if verbose mode
|
||||||
*/
|
*/
|
||||||
@@ -4623,15 +4731,6 @@ EOD;
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Log verbose details to file
|
|
||||||
*/
|
|
||||||
if ($verboseFile) {
|
|
||||||
$img->setVerboseToFile("$cachePath/log.txt");
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Load, process and output the image
|
* Load, process and output the image
|
||||||
*/
|
*/
|
||||||
|
125
webroot/imgp.php
125
webroot/imgp.php
@@ -982,6 +982,13 @@ class CImage
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add HTTP headers for outputing image.
|
||||||
|
*/
|
||||||
|
private $HTTPHeader = array();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Default background color, red, green, blue, alpha.
|
* Default background color, red, green, blue, alpha.
|
||||||
*
|
*
|
||||||
@@ -3341,11 +3348,28 @@ class CImage
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add HTTP header for putputting together with image.
|
||||||
|
*
|
||||||
|
* @param string $type the header type such as "Cache-Control"
|
||||||
|
* @param string $value the value to use
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function addHTTPHeader($type, $value)
|
||||||
|
{
|
||||||
|
$this->HTTPHeader[$type] = $value;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Output image to browser using caching.
|
* Output image to browser using caching.
|
||||||
*
|
*
|
||||||
* @param string $file to read and output, default is to use $this->cacheFileName
|
* @param string $file to read and output, default is to
|
||||||
* @param string $format set to json to output file as json object with details
|
* use $this->cacheFileName
|
||||||
|
* @param string $format set to json to output file as json
|
||||||
|
* object with details
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
@@ -3382,6 +3406,10 @@ class CImage
|
|||||||
header('Last-Modified: ' . $gmdate . " GMT");
|
header('Last-Modified: ' . $gmdate . " GMT");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
foreach($this->HTTPHeader as $key => $val) {
|
||||||
|
header("$key: $val");
|
||||||
|
}
|
||||||
|
|
||||||
if (isset($_SERVER['HTTP_IF_MODIFIED_SINCE']) && strtotime($_SERVER['HTTP_IF_MODIFIED_SINCE']) == $lastModified) {
|
if (isset($_SERVER['HTTP_IF_MODIFIED_SINCE']) && strtotime($_SERVER['HTTP_IF_MODIFIED_SINCE']) == $lastModified) {
|
||||||
|
|
||||||
if ($this->verbose) {
|
if ($this->verbose) {
|
||||||
@@ -3606,7 +3634,7 @@ EOD;
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
$version = "v0.7.6* (2015-10-18)";
|
$version = "v0.7.7 (2015-10-21)";
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -4247,11 +4275,16 @@ verbose("use cache = $useCache");
|
|||||||
* quality, q - set level of quality for jpeg images
|
* quality, q - set level of quality for jpeg images
|
||||||
*/
|
*/
|
||||||
$quality = get(array('quality', 'q'));
|
$quality = get(array('quality', 'q'));
|
||||||
|
$qualityDefault = getConfig('jpg_quality', null);
|
||||||
|
|
||||||
is_null($quality)
|
is_null($quality)
|
||||||
or ($quality > 0 and $quality <= 100)
|
or ($quality > 0 and $quality <= 100)
|
||||||
or errorPage('Quality out of range');
|
or errorPage('Quality out of range');
|
||||||
|
|
||||||
|
if (is_null($quality) && !is_null($qualityDefault)) {
|
||||||
|
$quality = $qualityDefault;
|
||||||
|
}
|
||||||
|
|
||||||
verbose("quality = $quality");
|
verbose("quality = $quality");
|
||||||
|
|
||||||
|
|
||||||
@@ -4260,12 +4293,16 @@ verbose("quality = $quality");
|
|||||||
* compress, co - what strategy to use when compressing png images
|
* compress, co - what strategy to use when compressing png images
|
||||||
*/
|
*/
|
||||||
$compress = get(array('compress', 'co'));
|
$compress = get(array('compress', 'co'));
|
||||||
|
$compressDefault = getConfig('png_compression', null);
|
||||||
|
|
||||||
is_null($compress)
|
is_null($compress)
|
||||||
or ($compress > 0 and $compress <= 9)
|
or ($compress > 0 and $compress <= 9)
|
||||||
or errorPage('Compress out of range');
|
or errorPage('Compress out of range');
|
||||||
|
|
||||||
|
if (is_null($compress) && !is_null($compressDefault)) {
|
||||||
|
$compress = $compressDefault;
|
||||||
|
}
|
||||||
|
|
||||||
verbose("compress = $compress");
|
verbose("compress = $compress");
|
||||||
|
|
||||||
|
|
||||||
@@ -4517,6 +4554,18 @@ $cachePath = getConfig('cache_path', __DIR__ . '/../cache/');
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the cachepath from config.
|
||||||
|
*/
|
||||||
|
$cacheControl = getConfig('cache_control', null);
|
||||||
|
|
||||||
|
if ($cacheControl) {
|
||||||
|
verbose("cacheControl = $cacheControl");
|
||||||
|
$img->addHTTPHeader("Cache-Control", $cacheControl);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Prepare a dummy image and use it as source image.
|
* Prepare a dummy image and use it as source image.
|
||||||
*/
|
*/
|
||||||
@@ -4586,6 +4635,65 @@ EOD;
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Log verbose details to file
|
||||||
|
*/
|
||||||
|
if ($verboseFile) {
|
||||||
|
$img->setVerboseToFile("$cachePath/log.txt");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Hook after img.php configuration and before processing with CImage
|
||||||
|
*/
|
||||||
|
$hookBeforeCImage = getConfig('hook_before_CImage', null);
|
||||||
|
|
||||||
|
if (is_callable($hookBeforeCImage)) {
|
||||||
|
verbose("hookBeforeCImage activated");
|
||||||
|
|
||||||
|
$allConfig = $hookBeforeCImage($img, array(
|
||||||
|
// Options for calculate dimensions
|
||||||
|
'newWidth' => $newWidth,
|
||||||
|
'newHeight' => $newHeight,
|
||||||
|
'aspectRatio' => $aspectRatio,
|
||||||
|
'keepRatio' => $keepRatio,
|
||||||
|
'cropToFit' => $cropToFit,
|
||||||
|
'fillToFit' => $fillToFit,
|
||||||
|
'crop' => $crop,
|
||||||
|
'area' => $area,
|
||||||
|
'upscale' => $upscale,
|
||||||
|
|
||||||
|
// Pre-processing, before resizing is done
|
||||||
|
'scale' => $scale,
|
||||||
|
'rotateBefore' => $rotateBefore,
|
||||||
|
'autoRotate' => $autoRotate,
|
||||||
|
|
||||||
|
// General processing options
|
||||||
|
'bgColor' => $bgColor,
|
||||||
|
|
||||||
|
// Post-processing, after resizing is done
|
||||||
|
'palette' => $palette,
|
||||||
|
'filters' => $filters,
|
||||||
|
'sharpen' => $sharpen,
|
||||||
|
'emboss' => $emboss,
|
||||||
|
'blur' => $blur,
|
||||||
|
'convolve' => $convolve,
|
||||||
|
'rotateAfter' => $rotateAfter,
|
||||||
|
|
||||||
|
// Output format
|
||||||
|
'outputFormat' => $outputFormat,
|
||||||
|
'dpr' => $dpr,
|
||||||
|
|
||||||
|
// Other
|
||||||
|
'postProcessing' => $postProcessing,
|
||||||
|
));
|
||||||
|
verbose(print_r($allConfig, 1));
|
||||||
|
extract($allConfig);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Display image if verbose mode
|
* Display image if verbose mode
|
||||||
*/
|
*/
|
||||||
@@ -4623,15 +4731,6 @@ EOD;
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Log verbose details to file
|
|
||||||
*/
|
|
||||||
if ($verboseFile) {
|
|
||||||
$img->setVerboseToFile("$cachePath/log.txt");
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Load, process and output the image
|
* Load, process and output the image
|
||||||
*/
|
*/
|
||||||
|
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user