if ($cacheControl) { verbose("cacheControl = {$cacheControl}"); $img->addHTTPHeader("Cache-Control", $cacheControl); } if ($dummyImage === true) { $dummyDir = $cache->getPathToSubdir("dummy"); $img->setSaveFolder($dummyDir)->setSource($dummyFilename, $dummyDir)->setOptions(array('newWidth' => $newWidth, 'newHeight' => $newHeight, 'bgColor' => $bgColor))->setJpegQuality($quality)->setPngCompression($compress)->createDummyImage()->generateFilename(null, false)->save(null, null, false); $srcImage = $img->getTarget(); $imagePath = null; verbose("src (updated) = {$srcImage}"); } $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 || $srgbDefault) { $filename = $img->convert2sRGBColorSpace($srcImage, $imagePath, $cache->getPathToSubdir("srgb"), $srgbColorProfile, $useCache); if ($filename) { $srcImage = $img->getTarget(); $imagePath = null; verbose("srgb conversion and saved to cache = {$srcImage}"); } else { verbose("srgb not op"); } } if ($status) { $text = "img.php version = {$version}\n"; $text .= "PHP version = " . PHP_VERSION . "\n"; $text .= "Running on: " . $_SERVER['SERVER_SOFTWARE'] . "\n"; $text .= "Allow remote images = {$allowRemote}\n"; $res = $cache->getStatusOfSubdir(""); $text .= "Cache {$res}\n";
$srcImage = $img->getTarget(); $imagePath = null; verbose("src (updated) = {$srcImage}"); } $srgbDirName = "/srgb"; $srgbDir = realpath(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 || $srgbDefault) { if (!is_writable($srgbDir)) { if (is_writable($cachePath)) { mkdir($srgbDir); } } $filename = $img->convert2sRGBColorSpace($srcImage, $imagePath, $srgbDir, $srgbColorProfile, $useCache); if ($filename) { $srcImage = $img->getTarget(); $imagePath = null; verbose("srgb conversion and saved to cache = {$srcImage}"); } else { verbose("srgb not op"); } } if ($status) { $text = "img.php version = {$version}\n"; $text .= "PHP version = " . PHP_VERSION . "\n"; $text .= "Running on: " . $_SERVER['SERVER_SOFTWARE'] . "\n"; $text .= "Allow remote images = {$allowRemote}\n"; $text .= "Cache writable = " . is_writable($cachePath) . "\n"; $text .= "Cache dummy writable = " . is_writable($dummyDir) . "\n";
/** * Test * * @return void */ public function testCreate2() { $img = new CImage(); $filename = $img->convert2sRGBColorSpace('car.jpg', IMAGE_PATH, $this->cache, $this->srgbColorProfile); $this->assertFalse($filename); }