Beispiel #1
0
$args = getImageParameters($args, filesystemToInternal($album));
list($size, $width, $height, $cw, $ch, $cx, $cy, $quality, $thumb, $crop, $thumbstandin, $passedWM, $adminrequest, $effects) = $args;
if (DEBUG_IMAGE) {
    debugLog("i.php({$ralbum}, {$rimage}): \$size={$size}, \$width={$width}, \$height={$height}, \$cw={$cw}, \$ch={$ch}, \$cx={$cx}, \$cy={$cy}, \$quality={$quality}, \$thumb={$thumb}, \$crop={$crop}, \$thumbstandin={$thumbstandin}, \$passedWM={$passedWM}, \$adminrequest={$adminrequest}, \$effects={$effects}");
}
$allowWatermark = !$thumb && !$adminrequest;
// Construct the filename to save the cached image.
$newfilename = getImageCacheFilename(filesystemToInternal($album), filesystemToInternal($image), $args);
$newfile = SERVERCACHE . $newfilename;
if (trim($album) == '') {
    $imgfile = ALBUM_FOLDER_SERVERPATH . $image;
} else {
    $imgfile = ALBUM_FOLDER_SERVERPATH . $album . '/' . $image;
}
if ($debug) {
    imageDebug($album, $image, $args, $imgfile);
}
/** Check for possible problems ***********
 * **************************************** */
// Make sure the cache directory is writable, attempt to fix. Issue a warning if not fixable.
if (!is_dir(SERVERCACHE)) {
    @mkdir(SERVERCACHE, FOLDER_MOD);
    @chmod(SERVERCACHE, FOLDER_MOD);
    if (!is_dir(SERVERCACHE)) {
        imageError('404 Not Found', gettext("The cache directory does not exist. Please create it and set the permissions to 0777."), 'err-cachewrite.png');
    }
}
if (!is_writable(SERVERCACHE)) {
    @chmod(SERVERCACHE, FOLDER_MOD);
    if (!is_writable(SERVERCACHE)) {
        imageError('404 Not Found', gettext("The cache directory is not writable! Attempts to chmod did not work."), 'err-cachewrite.png');
Beispiel #2
0
    //9 crop
    $args[] = NULL;
    //10 thumb standin
    if (isset($_GET['wmt']) && !$adminrequest) {
        //11
        $args[] = $_GET['wmt'];
    } else {
        $args[] = NULL;
    }
    $args[] = $adminrequest;
    //12
    $args = getImageParameters($args);
    list($size, $width, $height, $cw, $ch, $cx, $cy, $quality, $thumb, $crop, $thumbstandin, $thumbWM, $adminrequest) = $args;
    $allowWatermark = !$thumb && !$adminrequest;
    if ($debug) {
        imageDebug($album, $image, $args);
    }
} else {
    // No image parameters specified or are out of bounds; return the original image.
    //TODO: this will fail when the album folder is external to zp. Maybe should force the sizes within bounds.
    header("Location: " . getAlbumFolder(FULLWEBPATH) . pathurlencode(FilesystemToUTF8($album)) . "/" . rawurlencode(filesystemToUTF8($image)));
    return;
}
// Construct the filename to save the cached image.
$newfilename = getImageCacheFilename(FilesystemToUTF8($album), filesystemToUTF8($image), $args);
$newfile = SERVERCACHE . $newfilename;
if (trim($album) == '') {
    $imgfile = getAlbumFolder() . $image;
} else {
    $imgfile = getAlbumFolder() . $album . '/' . $image;
}