1
0
mirror of https://github.com/mosbth/cimage.git synced 2025-08-22 23:52:51 +02:00

Added conversion to sRGB using option ?srgb. #120.

This commit is contained in:
Mikael Roos
2015-10-24 15:43:56 +02:00
parent aedce7021f
commit 7a98a44dd4
7 changed files with 38 additions and 15 deletions

View File

@@ -8,7 +8,7 @@
*
*/
$version = "v0.7.7* (2015-10-21)";
$version = "v0.7.7* (2015-10-24)";
@@ -976,10 +976,12 @@ if ($dummyImage === true) {
* Prepare a sRGB version of the image and use it as source image.
*/
$srgbDirName = "/srgb";
$srgbDir = getConfig('srgb_dir', $cachePath . $srgbDirName);
$srgb = getDefined('srgb', true, null);
$srgbDir = getConfig('srgb_dir', $cachePath . $srgbDirName);
$srgbDefault = getConfig('srgb_default', false);
$srgbColorProfile = getConfig('srgb_colorprofile', __DIR__ . '/../icc/sRGB_IEC61966-2-1_black_scaled.icc');
$srgb = getDefined('srgb', true, null);
if ($srgb) {
if ($srgb || $srgbDefault) {
if (!is_writable($srgbDir)) {
if (is_writable($cachePath)) {
@@ -991,6 +993,7 @@ if ($srgb) {
$srcImage,
$imagePath,
$srgbDir,
$srgbColorProfile,
$useCache
);

BIN
webroot/img/hamburger.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 517 KiB

View File

@@ -122,6 +122,24 @@ return array(
/**
* Convert the image to srgb before processing. Saves the converted
* image in the sub cache dir. This option is default false but can
* be changed to default true to do this conversion for all images.
* This option requires PHP extension imagick and will silently fail
* if that is not installed.
*
* Default value:
* srgb_dir: $cachePath/srgb
* srgb_default: false
* srgb_colorprofile: __DIR__ . '/../icc/sRGB_IEC61966-2-1_black_scaled.icc'
*/
//'srgb_dir' => __DIR__ . '/../cache/srgb/',
//'srgb_default' => false,
//'srgb_colorprofile' => __DIR__ . '/../icc/sRGB_IEC61966-2-1_black_scaled.icc',
/**
* A function (hook) can be called after img.php has processed all
* configuration options and before processing the image using CImage.