Exemple #1
0
$validAliasname = getConfig('valid_aliasname', '#^[a-z0-9A-Z-_]+$#');
$aliasTarget = null;
if ($alias && $aliasPath && $passwordMatch) {
    $aliasTarget = $aliasPath . $alias;
    $useCache = false;
    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) {