Exemplo n.º 1
0
////////////////////////////////////////////////////////////////
$phpthumb->GenerateThumbnail();
////////////////////////////////////////////////////////////////
// Debug output, to try and help me diagnose problems
if (@$_GET['phpthumbDebug'] == '8') {
    $phpthumb->phpthumbDebug();
}
////////////////////////////////////////////////////////////////
if ($phpthumb->file) {
    $phpthumb->RenderToFile($phpthumb->ResolveFilenameToAbsolute($phpthumb->file));
    if ($phpthumb->goto && substr(strtolower($phpthumb->goto), 0, strlen('http://')) == 'http://') {
        // redirect to another URL after image has been rendered to file
        header('Location: ' . $phpthumb->goto);
        exit;
    }
} else {
    if (file_exists($phpthumb->cache_filename) && is_writable($phpthumb->cache_filename) || is_writable(dirname($phpthumb->cache_filename))) {
        $phpthumb->CleanUpCacheDirectory();
        $phpthumb->RenderToFile($phpthumb->cache_filename);
    } 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
if (@$_GET['phpthumbDebug'] == '9') {
    $phpthumb->phpthumbDebug();
}
////////////////////////////////////////////////////////////////
$phpthumb->OutputThumbnail();