/** * Test * * @return void */ public function testCreate2() { $img = new CImage(); $img->setSaveFolder($this->cachepath); $img->setSource(self::DUMMY, $this->cachepath); $img->createDummyImage(200, 400); $img->generateFilename(null, false); $img->save(null, null, false); $filename = $img->getTarget(); $this->assertEquals(basename($filename), self::DUMMY . "_200_400", "Filename not as expected on dummy image."); }
/** * Test * * @return void */ public function testCreate2() { $img = new CImage(); $img->setSaveFolder(CACHE_PATH . "/dummy"); $img->setSource('dummy', CACHE_PATH . "/dummy"); $img->createDummyImage(200, 400); $img->generateFilename(null, false); $img->save(null, null, false); $filename = $img->getTarget(); $this->assertEquals(basename($filename), "dummy_200_400", "Filename not as expected on dummy image."); }
is_writable($aliasPath) or errorPage("Directory for alias is not writable.", 403); preg_match($validAliasname, $alias) or errorPage('Filename for alias contains invalid characters. Do not add extension.', 404); } elseif ($alias) { errorPage('Alias is not enabled in the config file or password not matching.', 403); } verbose("alias = {$alias}"); $cachePath = getConfig('cache_path', __DIR__ . '/../cache/'); $cacheControl = getConfig('cache_control', null); if ($cacheControl) { verbose("cacheControl = {$cacheControl}"); $img->addHTTPHeader("Cache-Control", $cacheControl); } $dummyDir = getConfig('dummy_dir', $cachePath . "/" . $dummyFilename); if ($dummyImage === true) { is_writable($dummyDir) or verbose("dummy dir not writable = {$dummyDir}"); $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}"); } $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); } }