コード例 #1
0
ファイル: imgp.php プロジェクト: hunnybohara/coin_bates
 * Get the source files.
 */
$autoloader = getConfig('autoloader', false);
$cimageClass = getConfig('cimage_class', false);
if ($autoloader) {
    require $autoloader;
} else {
    if ($cimageClass) {
        require $cimageClass;
    }
}
/**
 * Create the class for the image.
 */
$img = new CImage();
$img->setVerbose($verbose);
/**
 * Allow or disallow remote download of images from other servers.
 * Passwords apply if used.
 *
 */
$allowRemote = getConfig('remote_allow', false);
if ($allowRemote && $passwordMatch !== false) {
    $pattern = getConfig('remote_pattern', null);
    $img->setRemoteDownload($allowRemote, $pattern);
    $whitelist = getConfig('remote_whitelist', null);
    $img->setRemoteHostWhitelist($whitelist);
}
/**
 * shortcut, sc - extend arguments with a constant value, defined
 * in config-file.
コード例 #2
0
ファイル: imgs.php プロジェクト: sonyarianto/cimage
    } else {
        errorPage("Hotlinking/leeching not allowed.", 403);
    }
}
verbose("allow_hotlinking = {$allowHotlinking}");
verbose("referer = {$referer}");
verbose("referer host = {$refererHost}");
$autoloader = getConfig('autoloader', false);
$cimageClass = getConfig('cimage_class', false);
if ($autoloader) {
    require $autoloader;
} elseif ($cimageClass) {
    require $cimageClass;
}
$img = new CImage();
$img->setVerbose($verbose || $verboseFile);
$allowRemote = getConfig('remote_allow', false);
if ($allowRemote && $passwordMatch !== false) {
    $pattern = getConfig('remote_pattern', null);
    $img->setRemoteDownload($allowRemote, $pattern);
    $whitelist = getConfig('remote_whitelist', null);
    $img->setRemoteHostWhitelist($whitelist);
}
$shortcut = get(array('shortcut', 'sc'), null);
$shortcutConfig = getConfig('shortcut', array('sepia' => "&f=grayscale&f0=brightness,-10&f1=contrast,-20&f2=colorize,120,60,0,0&sharpen"));
verbose("shortcut = {$shortcut}");
if (isset($shortcut) && isset($shortcutConfig[$shortcut])) {
    parse_str($shortcutConfig[$shortcut], $get);
    verbose("shortcut-constant = {$shortcutConfig[$shortcut]}");
    $_GET = array_merge($_GET, $get);
}
コード例 #3
0
ファイル: img.php プロジェクト: rcus/javascript
<?php

/**
 * This is a PHP script which call CImage to get an image.
 *
 */
// Array for configuration
$config = array('imgDir' => realpath(__DIR__) . DIRECTORY_SEPARATOR, 'cacheDir' => realpath(__DIR__ . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'cache') . DIRECTORY_SEPARATOR, 'maxWidth' => 2000, 'maxHeight' => 2000);
// Include source from CImage.php.
require_once '../../src/CImage/CImage.php';
// Create a image object
$image = new CImage($config);
// Get the incoming arguments and set the values in the image object
$image->setSrc(isset($_GET['src']) ? $_GET['src'] : null);
$image->setVerbose(isset($_GET['verbose']) ? true : null);
$image->setSaveAs(isset($_GET['save-as']) ? $_GET['save-as'] : null);
$image->setQuality(isset($_GET['quality']) ? $_GET['quality'] : 60);
$image->setIgnoreCache(isset($_GET['no-cache']) ? true : null);
$image->setNewWidth(isset($_GET['width']) ? $_GET['width'] : null);
$image->setNewHeight(isset($_GET['height']) ? $_GET['height'] : null);
$image->setCropToFit(isset($_GET['crop-to-fit']) ? true : null);
$image->setSharpen(isset($_GET['sharpen']) ? true : null);
// Get the image
$image->getOutput();