} else { unset($_GET[$key]); } } } } if (!@$_SERVER['PATH_INFO'] && !@$_SERVER['QUERY_STRING']) { $phpThumb->ErrorImage('phpThumb() v' . $phpThumb->phpthumb_version . '<br><a href="http://phpthumb.sourceforge.net">http://phpthumb.sourceforge.net</a><br><br>ERROR: no parameters specified'); } if (@$_GET['src'] && isset($_GET['md5s']) && empty($_GET['md5s'])) { if (preg_match('/^(f|ht)tps?\\:\\/\\//i', $_GET['src'])) { if ($rawImageData = phpthumb_functions::SafeURLread($_GET['src'], $error, $phpThumb->config_http_fopen_timeout, $phpThumb->config_http_follow_redirect)) { $md5s = md5($rawImageData); } } else { $SourceFilename = $phpThumb->ResolveFilenameToAbsolute($_GET['src']); if (is_readable($SourceFilename)) { $md5s = phpthumb_functions::md5_file_safe($SourceFilename); } else { $phpThumb->ErrorImage('ERROR: "' . $SourceFilename . '" cannot be read'); } } if (@$_SERVER['HTTP_REFERER']) { $phpThumb->ErrorImage('&md5s=' . $md5s); } else { die('&md5s=' . $md5s); } } if (!empty($PHPTHUMB_CONFIG)) { foreach ($PHPTHUMB_CONFIG as $key => $value) { $keyname = 'config_' . $key;
if (@$_REQUEST['phpThumbDebug'] == '1') { $phpThumb->phpThumbDebug(); } //////////////////////////////////////////////////////////////// // check to see if file can be output from source with no processing or caching $CanPassThroughDirectly = true; $FilenameParameters = array('h', 'w', 'sx', 'sy', 'sw', 'sh', 'bw', 'brx', 'bry', 'bg', 'bgt', 'bc', 'usa', 'usr', 'ust', 'wmf', 'wmp', 'wmm', 'wma', 'xto', 'ra', 'ar', 'iar', 'maxb'); foreach ($FilenameParameters as $key) { if (isset($_REQUEST[$key])) { $CanPassThroughDirectly = false; break; } } if ($CanPassThroughDirectly && !empty($_REQUEST['src'])) { // no parameters set, passthru $SourceFilename = $phpThumb->ResolveFilenameToAbsolute($_REQUEST['src']); if ($getimagesize = @GetImageSize($SourceFilename)) { header('Content-type: ' . phpthumb_functions::ImageTypeToMIMEtype($getimagesize[2])); @readfile($SourceFilename); exit; } } // check to see if file already exists in cache, and output it with no processing if it does if (!empty($phpThumb->config_cache_directory) && empty($_REQUEST['phpThumbDebug'])) { $cache_filename = $phpThumb->GenerateCachedFilename(); if (is_file($cache_filename)) { header('Content-type: image/' . $phpThumb->thumbnailFormat); @readfile($cache_filename); exit; } }