当前位置: 首页>>代码示例>>PHP>>正文


PHP phpThumb::CleanUpCacheDirectory方法代码示例

本文整理汇总了PHP中phpThumb::CleanUpCacheDirectory方法的典型用法代码示例。如果您正苦于以下问题:PHP phpThumb::CleanUpCacheDirectory方法的具体用法?PHP phpThumb::CleanUpCacheDirectory怎么用?PHP phpThumb::CleanUpCacheDirectory使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在phpThumb的用法示例。


在下文中一共展示了phpThumb::CleanUpCacheDirectory方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: spit_phpthumb_image

function spit_phpthumb_image($filepath, $configarray = array())
{
    // set up class
    global $CFG, $PHPTHUMB_CONFIG;
    $phpThumb = new phpThumb();
    // import default config
    if (!empty($PHPTHUMB_CONFIG)) {
        foreach ($PHPTHUMB_CONFIG as $key => $value) {
            $keyname = 'config_' . $key;
            $phpThumb->setParameter($keyname, $value);
        }
    }
    // import passed params
    if (!empty($configarray)) {
        foreach ($configarray as $key => $value) {
            $keyname = $key;
            $phpThumb->setParameter($keyname, $value);
        }
    }
    $phpThumb->setSourceFilename($filepath);
    if (!is_file($phpThumb->sourceFilename) && !phpthumb_functions::gd_version()) {
        if (!headers_sent()) {
            // base64-encoded error image in GIF format
            $ERROR_NOGD = 'R0lGODlhIAAgALMAAAAAABQUFCQkJDY2NkZGRldXV2ZmZnJycoaGhpSUlKWlpbe3t8XFxdXV1eTk5P7+/iwAAAAAIAAgAAAE/vDJSau9WILtTAACUinDNijZtAHfCojS4W5H+qxD8xibIDE9h0OwWaRWDIljJSkUJYsN4bihMB8th3IToAKs1VtYM75cyV8sZ8vygtOE5yMKmGbO4jRdICQCjHdlZzwzNW4qZSQmKDaNjhUMBX4BBAlmMywFSRWEmAI6b5gAlhNxokGhooAIK5o/pi9vEw4Lfj4OLTAUpj6IabMtCwlSFw0DCKBoFqwAB04AjI54PyZ+yY3TD0ss2YcVmN/gvpcu4TOyFivWqYJlbAHPpOntvxNAACcmGHjZzAZqzSzcq5fNjxFmAFw9iFRunD1epU6tsIPmFCAJnWYE0FURk7wJDA0MTKpEzoWAAskiAAA7';
            header('Content-Type: image/gif');
            echo base64_decode($ERROR_NOGD);
        } else {
            echo '*** ERROR: No PHP-GD support available ***';
        }
        exit;
    }
    $phpThumb->SetCacheFilename();
    if (!file_exists($phpThumb->cache_filename) && is_writable(dirname($phpThumb->cache_filename))) {
        //         error_log("generating to cache: " . $phpThumb->cache_filename);
        $phpThumb->CleanUpCacheDirectory();
        $phpThumb->GenerateThumbnail();
        $phpThumb->RenderToFile($phpThumb->cache_filename);
    }
    if (is_file($phpThumb->cache_filename)) {
        //         error_log("sending from cache: " . $phpThumb->cache_filename);
        if ($getimagesize = @GetImageSize($phpThumb->cache_filename)) {
            $mimetype = phpthumb_functions::ImageTypeToMIMEtype($getimagesize[2]);
        }
        spitfile_with_mtime_check($phpThumb->cache_filename, $mimetype);
    } else {
        //         error_log("phpthumb cache file doesn't exist: " . $phpThumb->cache_filename);
        $phpThumb->GenerateThumbnail();
        $phpThumb->OutputThumbnail();
        exit;
    }
}
开发者ID:pzingg,项目名称:saugus_elgg,代码行数:51,代码来源:iconslib.php

示例2: header

    $phpThumb->phpThumbDebug();
}
////////////////////////////////////////////////////////////////
if ($phpThumb->config_allow_parameter_file && $phpThumb->file) {
    $phpThumb->RenderToFile($phpThumb->ResolveFilenameToAbsolute($phpThumb->file));
    if ($phpThumb->config_allow_parameter_goto && $phpThumb->goto && preg_match('/^(f|ht)tps?\\:\\/\\//i', $phpThumb->goto)) {
        // redirect to another URL after image has been rendered to file
        header('Location: ' . $phpThumb->goto);
        exit;
    }
} elseif (@$PHPTHUMB_CONFIG['high_security_enabled'] && @$_GET['nocache']) {
    // cache disabled, don't write cachefile
} else {
    phpthumb_functions::EnsureDirectoryExists(dirname($phpThumb->cache_filename));
    if (@file_exists($phpThumb->cache_filename) && is_writable($phpThumb->cache_filename) || is_writable(dirname($phpThumb->cache_filename))) {
        $phpThumb->CleanUpCacheDirectory();
        if ($phpThumb->RenderToFile($phpThumb->cache_filename) && is_readable($phpThumb->cache_filename)) {
            chmod($phpThumb->cache_filename, 0644);
            RedirectToCachedFile();
        } else {
            $phpThumb->DebugMessage('Failed: RenderToFile(' . $phpThumb->cache_filename . ')', __FILE__, __LINE__);
        }
    } else {
        $phpThumb->DebugMessage('Cannot write to $phpThumb->cache_filename (' . $phpThumb->cache_filename . ') because that directory (' . dirname($phpThumb->cache_filename) . ') is not writable', __FILE__, __LINE__);
    }
}
////////////////////////////////////////////////////////////////
// Debug output, to try and help me diagnose problems
$phpThumb->DebugTimingMessage('phpThumbDebug[9]', __FILE__, __LINE__);
if (@$_GET['phpThumbDebug'] == '9') {
    $phpThumb->phpThumbDebug();
开发者ID:CrazyBobik,项目名称:allotaxi.test,代码行数:31,代码来源:phpThumb.php


注:本文中的phpThumb::CleanUpCacheDirectory方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。