本文整理汇总了PHP中timthumb::tryServerCache方法的典型用法代码示例。如果您正苦于以下问题:PHP timthumb::tryServerCache方法的具体用法?PHP timthumb::tryServerCache怎么用?PHP timthumb::tryServerCache使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类timthumb
的用法示例。
在下文中一共展示了timthumb::tryServerCache方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: start
/**
* timthumb::start()
*
* @return
*/
public static function start()
{
$tim = new timthumb();
$tim->handleErrors();
$tim->securityChecks();
if ($tim->tryBrowserCache()) {
exit(0);
}
$tim->handleErrors();
if (FILE_CACHE_ENABLED && $tim->tryServerCache()) {
exit(0);
}
$tim->handleErrors();
$tim->run();
$tim->handleErrors();
exit(0);
}
示例2: start
public static function start($param_array)
{
self::$param_array = $param_array;
$tim = new timthumb();
$tim->handleErrors();
$tim->securityChecks();
if ($tim->tryBrowserCache()) {
return $tim->cachefile;
//exit(0);
}
$tim->handleErrors();
if (FILE_CACHE_ENABLED && $tim->tryServerCache()) {
return $tim->cachefile;
//exit(0);
}
$tim->handleErrors();
$tim->run();
$tim->handleErrors();
return $tim->cachefile;
//exit(0);
}
示例3: start
/**
* @param array $options
*/
public static function start(array $options = null)
{
//Image fetching and caching
if (!defined('FILE_CACHE_TIME_BETWEEN_CLEANS')) {
define('FILE_CACHE_TIME_BETWEEN_CLEANS', 86400);
}
// How often the cache is cleaned
if (!defined('FILE_CACHE_MAX_FILE_AGE')) {
define('FILE_CACHE_MAX_FILE_AGE', 86400);
}
// How old does a file have to be to be deleted from the cache
if (!defined('FILE_CACHE_SUFFIX')) {
define('FILE_CACHE_SUFFIX', '.timthumb.txt');
}
// What to put at the end of all files in the cache directory so we can identify them
if (!defined('FILE_CACHE_PREFIX')) {
define('FILE_CACHE_PREFIX', 'timthumb');
}
// What to put at the beg of all files in the cache directory so we can identify them
if (!defined('MAX_FILE_SIZE')) {
define('MAX_FILE_SIZE', 10485760);
}
// 10 Megs is 10485760. This is the max internal or external file size that we'll process.
if (!defined('CURL_TIMEOUT')) {
define('CURL_TIMEOUT', 20);
}
// Timeout duration for Curl. This only applies if you have Curl installed and aren't using PHP's default URL fetching mechanism.
if (!defined('WAIT_BETWEEN_FETCH_ERRORS')) {
define('WAIT_BETWEEN_FETCH_ERRORS', 3600);
}
// Time to wait between errors fetching remote file
//Browser caching
if (!defined('BROWSER_CACHE_MAX_AGE')) {
define('BROWSER_CACHE_MAX_AGE', 864000);
}
// Time to cache in the browser
if (!defined('BROWSER_CACHE_DISABLE')) {
define('BROWSER_CACHE_DISABLE', false);
}
// Use for testing if you want to disable all browser caching
//Image size and defaults
if (!defined('NOT_FOUND_IMAGE')) {
define('NOT_FOUND_IMAGE', '');
}
// Image to serve if any 404 occurs
if (!defined('ERROR_IMAGE')) {
define('ERROR_IMAGE', '');
}
// Image to serve if an error occurs instead of showing error message
if (!defined('PNG_IS_TRANSPARENT')) {
define('PNG_IS_TRANSPARENT', FALSE);
}
// Define if a png image should have a transparent background color. Use False value if you want to display a custom coloured canvas_colour
//Image compression is enabled if either of these point to valid paths
//These are now disabled by default because the file sizes of PNGs (and GIFs) are much smaller than we used to generate.
//They only work for PNGs. GIFs and JPEGs are not affected.
if (!defined('OPTIPNG_ENABLED')) {
define('OPTIPNG_ENABLED', false);
}
if (!defined('OPTIPNG_PATH')) {
define('OPTIPNG_PATH', '/usr/bin/optipng');
}
//This will run first because it gives better compression than pngcrush.
if (!defined('PNGCRUSH_ENABLED')) {
define('PNGCRUSH_ENABLED', false);
}
if (!defined('PNGCRUSH_PATH')) {
define('PNGCRUSH_PATH', '/usr/bin/pngcrush');
}
//This will only run if OPTIPNG_PATH is not set or is not valid
$tim = new timthumb($options);
$tim->handleErrors();
$tim->securityChecks();
if ($tim->tryBrowserCache()) {
exit(0);
}
$tim->handleErrors();
if (static::$options['file_cache_enabled'] && $tim->tryServerCache()) {
exit(0);
}
$tim->handleErrors();
$tim->run();
$tim->handleErrors();
exit(0);
}
示例4: start
public static function start()
{
if (LIMIT_ON) {
if (count($_GET) > 1 || !$_GET['src'] || $_POST) {
return;
}
}
$tim = new timthumb();
$tim->handleErrors();
$tim->securityChecks();
if ($tim->tryBrowserCache()) {
exit(0);
}
$tim->handleErrors();
if (FILE_CACHE_ENABLED && $tim->tryServerCache()) {
exit(0);
}
$tim->handleErrors();
$tim->run();
$tim->handleErrors();
exit(0);
}