コード例 #1
0
                header('Content-Type: ' . phpthumb_functions::ImageTypeToMIMEtype($getimagesize[2]));
            }
            @readfile($SourceFilename);
            exit;
        }
    }
    break;
}
////////////////////////////////////////////////////////////////
// Debug output, to try and help me diagnose problems
if (@$_GET['phpthumbDebug'] == '5') {
    $phpthumb->phpthumbDebug();
}
////////////////////////////////////////////////////////////////
// check to see if file already exists in cache, and output it with no processing if it does
$phpthumb->SetCacheFilename();
if (is_file($phpthumb->cache_filename)) {
    $parsed_url = @parse_url(@$_SERVER['HTTP_REFERER']);
    if ($phpthumb->config_nooffsitelink_enabled && @$_SERVER['HTTP_REFERER'] && !in_array(@$parsed_url['host'], $phpthumb->config_nooffsitelink_valid_domains)) {
        $phpthumb->DebugMessage('Would have used cached (image/' . $phpthumb->thumbnailFormat . ') file "' . $phpthumb->cache_filename . '" (Last-Modified: ' . gmdate('D, d M Y H:i:s', filemtime($phpthumb->cache_filename)) . ' GMT), but skipping because $_SERVER[HTTP_REFERER] (' . @$_SERVER['HTTP_REFERER'] . ') is not in $phpthumb->config_nooffsitelink_valid_domains (' . implode(';', $phpthumb->config_nooffsitelink_valid_domains) . ')', __FILE__, __LINE__);
    } elseif ($phpthumb->phpthumbDebug) {
        $phpthumb->DebugMessage('Would have used cached file, but skipping due to phpthumbDebug', __FILE__, __LINE__);
        $phpthumb->DebugMessage('* Would have sent headers (1): Last-Modified: ' . gmdate('D, d M Y H:i:s', filemtime($phpthumb->cache_filename)) . ' GMT', __FILE__, __LINE__);
        if ($getimagesize = @GetImageSize($phpthumb->cache_filename)) {
            $phpthumb->DebugMessage('* Would have sent headers (2): Content-Type: ' . phpthumb_functions::ImageTypeToMIMEtype($getimagesize[2]), __FILE__, __LINE__);
        }
        if (ereg('^' . preg_quote(str_replace($phpthumb->osslash, '/', $PHPTHUMB_CONFIG['document_root'])) . '(.*)$', str_replace($phpthumb->osslash, '/', $phpthumb->cache_filename), $matches)) {
            $phpthumb->DebugMessage('* Would have sent headers (3): Location: ' . dirname($matches[1]) . '/' . urlencode(basename($matches[1])), __FILE__, __LINE__);
        } else {
            $phpthumb->DebugMessage('* Would have sent headers (3): readfile(' . $phpthumb->cache_filename . ')', __FILE__, __LINE__);
        }