Lines Matching refs:phpThumb

39 	global $phpThumb;
44 …= phpthumb_functions::SanitizeFilename((!empty($phpThumb->src) ? basename($phpThumb->src) : md5($p…
47 …$phpThumb->DebugMessage('SendSaveAsFileHeaderIfNeeded() sending header: Content-Disposition: '.(!e…
54 global $phpThumb;
56 $nice_cachefile = str_replace(DIRECTORY_SEPARATOR, '/', $phpThumb->cache_filename);
57 …$nice_docroot = str_replace(DIRECTORY_SEPARATOR, '/', rtrim($phpThumb->config_document_root, '/\…
61 $nModified = filemtime($phpThumb->cache_filename);
63 …if ($phpThumb->config_nooffsitelink_enabled && !empty($_SERVER['HTTP_REFERER']) && !in_array(@$par…
65phpThumb->DebugMessage('Would have used cached (image/'.$phpThumb->thumbnailFormat.') file "'.$php…
67 } elseif ($phpThumb->phpThumbDebug) {
69 $phpThumb->DebugTimingMessage('skipped using cached image', __FILE__, __LINE__);
70 …$phpThumb->DebugMessage('Would have used cached file, but skipping due to phpThumbDebug', __FILE__…
71 …$phpThumb->DebugMessage('* Would have sent headers (1): Last-Modified: '.gmdate('D, d M Y H:i:s', …
72 if ($getimagesize = @getimagesize($phpThumb->cache_filename)) {
73 …$phpThumb->DebugMessage('* Would have sent headers (2): Content-Type: '.phpthumb_functions::ImageT…
76 …$phpThumb->DebugMessage('* Would have sent headers (3): Location: '.dirname($matches[1]).'/'.urlen…
78 …$phpThumb->DebugMessage('* Would have sent data: file_get_contents('.$phpThumb->cache_filename.')'…
84 $phpThumb->ErrorImage('Headers already sent ('.basename(__FILE__).' line '.__LINE__.')');
87 $getimagesize = @getimagesize($phpThumb->cache_filename);
91 header('Cache-Control: max-age='.$phpThumb->getParameter('config_cache_maxage'));
92 header('Expires: '.date(DATE_RFC1123, time() + $phpThumb->getParameter('config_cache_maxage')));
99 header('ETag: "'.md5_file($phpThumb->cache_filename).'"');
102 } elseif (preg_match('#\\.ico$#i', $phpThumb->cache_filename)) {
105 header('Content-Length: '.filesize($phpThumb->cache_filename));
106 …if (empty($phpThumb->config_cache_force_passthru) && preg_match('#^'.preg_quote($nice_docroot).'(.…
109 echo file_get_contents($phpThumb->cache_filename);
126 $phpThumb = new phpThumb(); variable
127 $phpThumb->DebugTimingMessage('phpThumb.php start', __FILE__, __LINE__, $starttime);
128 $phpThumb->setParameter('config_error_die_on_error', true);
143 $phpThumb->config_disable_debug = false; // otherwise error message won't print
144 …$phpThumb->ErrorImage('failed to include_once('. __DIR__ .'/phpThumb.config.php) - realpath="'.rea…
148 $phpThumb->config_disable_debug = false; // otherwise error message won't print
149 $phpThumb->ErrorImage('Please rename "phpThumb.config.php.default" to "phpThumb.config.php"');
151 $phpThumb->config_disable_debug = false; // otherwise error message won't print
152 …$phpThumb->ErrorImage('failed to include_once('. __DIR__ .'/phpThumb.config.php) - realpath="'.rea…
158 $phpThumb->setParameter($keyname, $value);
160 …$phpThumb->DebugMessage('setParameter('.$keyname.', '.$phpThumb->phpThumbDebugVarDump($value).')',…
163 if (!$phpThumb->config_disable_debug) {
166 $phpThumb->setParameter('phpThumbDebug', $_GET['phpThumbDebug']);
169 $phpThumb->DebugMessage('$PHPTHUMB_CONFIG is empty', __FILE__, __LINE__);
172 if (empty($phpThumb->config_disable_pathinfo_parsing) && (empty($_GET) || isset($_GET['phpThumbDebu…
176 $phpThumb->DebugMessage('PATH_INFO.$args set to ('.implode(')(', $args).')', __FILE__, __LINE__);
179 $phpThumb->DebugMessage('PATH_INFO."src" = "'.$_GET['src'].'"', __FILE__, __LINE__);
188 …$phpThumb->DebugMessage('PATH_INFO."w"x"h" set to "'.$_GET['w'].'"x"'.$_GET['h'].'"', __FILE__, __…
195 $phpThumb->DebugMessage('PATH_INFO."'.$array_key_name.'[]" = "'.$value.'"', __FILE__, __LINE__);
198 $phpThumb->DebugMessage('PATH_INFO."'.$key.'" = "'.$value.'"', __FILE__, __LINE__);
203 if (!empty($phpThumb->config_high_security_enabled)) {
205 $phpThumb->config_disable_debug = false; // otherwise error message won't print
206 $phpThumb->ErrorImage('ERROR: missing hash');
207 } elseif (phpthumb_functions::PasswordStrength($phpThumb->config_high_security_password) < 20) {
208 $phpThumb->config_disable_debug = false; // otherwise error message won't print
209 $phpThumb->ErrorImage('ERROR: $PHPTHUMB_CONFIG[high_security_password] is not complex enough');
210 …sha256', str_replace($phpThumb->config_high_security_url_separator.'hash='.$_GET['hash'], '', $_SE…
212 $phpThumb->ErrorImage('ERROR: invalid hash');
218 $phpThumb->DebugTimingMessage('phpThumbDebug[0]', __FILE__, __LINE__);
220 $phpThumb->phpThumbDebug();
243 $phpThumb->config_disable_debug = false; // otherwise error message won't print
244 $phpThumb->ErrorImage('ERROR: no parameters specified');
251 …pthumb_functions::SafeURLread($_GET['src'], $error, $phpThumb->config_http_fopen_timeout, $phpThum…
255 …$phpThumb->ErrorImage('only FTP and HTTP/HTTPS protocols are allowed, "'.$protocol_matches[1].'" i…
258 $SourceFilename = $phpThumb->ResolveFilenameToAbsolute($_GET['src']);
262 $phpThumb->ErrorImage('ERROR: "'.$SourceFilename.'" cannot be read');
266 $phpThumb->ErrorImage('&md5s='.$md5s);
272 if (!empty($_GET['src']) && empty($phpThumb->config_allow_local_http_src) && preg_match('#^http://'…
273 …$phpThumb->ErrorImage('It is MUCH better to specify the "src" parameter as "'.$matches[1].'" inste…
278 $phpThumb->DebugTimingMessage('phpThumbDebug[1]', __FILE__, __LINE__);
280 $phpThumb->phpThumbDebug();
285 if ($phpThumb->config_nooffsitelink_require_refer && !in_array(@$parsed_url_referer['host'], $phpTh…
286 …$phpThumb->ErrorImage('config_nooffsitelink_require_refer enabled and '.(@$parsed_url_referer['hos…
289phpThumb->config_nohotlink_enabled && $phpThumb->config_nohotlink_erase_image && preg_match('#^(f|…
290 $phpThumb->ErrorImage($phpThumb->config_nohotlink_text_message);
293 if ($phpThumb->config_mysql_query) {
294 if ($phpThumb->config_mysql_extension == 'mysqli') {
304 $phpThumb->ErrorImage('SQL function unavailable: '.$found_missing_function);
306 …mysqli = new mysqli($phpThumb->config_mysql_hostname, $phpThumb->config_mysql_username, $phpThumb-…
308 …$phpThumb->ErrorImage('MySQLi connect error ('.$mysqli->connect_errno.') '.$mysqli->connect_error);
310 if ($result = $mysqli->query($phpThumb->config_mysql_query)) {
315 $phpThumb->setSourceData($row[0]);
321 $phpThumb->ErrorImage('no matching data in database.');
325 $phpThumb->ErrorImage('Error in MySQL query: "'.$mysqli->error.'"');
331 } elseif ($phpThumb->config_mysql_extension == 'mysql') {
342 $phpThumb->ErrorImage('SQL function unavailable: '.$found_missing_function);
344 …if ($cid = @mysql_connect($phpThumb->config_mysql_hostname, $phpThumb->config_mysql_username, $php…
345 if (@mysql_select_db($phpThumb->config_mysql_database, $cid)) {
346 if ($result = @mysql_query($phpThumb->config_mysql_query, $cid)) {
351 $phpThumb->setSourceData($row[0]);
357 $phpThumb->ErrorImage('no matching data in database.');
361 $phpThumb->ErrorImage('Error in MySQL query: "'.mysql_error($cid).'"');
365 $phpThumb->ErrorImage('cannot select MySQL database: "'.mysql_error($cid).'"');
368 $phpThumb->ErrorImage('cannot connect to MySQL server');
374 $phpThumb->ErrorImage('config_mysql_extension not supported');
380 $phpThumb->DebugTimingMessage('phpThumbDebug[2]', __FILE__, __LINE__);
382 $phpThumb->phpThumbDebug();
386 …HPTHUMB_DEFAULTS_DISABLEGETPARAMS = (bool) ($phpThumb->config_cache_default_only_suffix && (strpos…
393 …$phpThumb->DebugMessage('ignoring $_GET['.$key.'] because of $PHPTHUMB_DEFAULTS_DISABLEGETPARAMS',…
395 …$phpThumb->DebugMessage('setParameter('.$key.', '.$phpThumb->phpThumbDebugVarDump($value).')', __F…
396 $phpThumb->setParameter($key, $value);
398 $phpThumb->ErrorImage('Forbidden parameter: '.$key);
403 …$phpThumb->DebugMessage('setting $PHPTHUMB_DEFAULTS['.implode(';', array_keys($PHPTHUMB_DEFAULTS))…
408 $phpThumb->setParameter($key, $value);
409 …$phpThumb->DebugMessage('setParameter('.$key.', '.$phpThumb->phpThumbDebugVarDump($value).') from …
416 $phpThumb->DebugTimingMessage('phpThumbDebug[3]', __FILE__, __LINE__);
418 $phpThumb->phpThumbDebug();
436 if ($phpThumb->rawImageData) {
438 } elseif (preg_match('#^https?\\://[^\\?&]+\\.(jpe?g|gif|png|webp|avif)$#i', $phpThumb->src)) {
440 } elseif (preg_match('#^(f|ht)tps?\\://#i', $phpThumb->src)) {
441 …$phpThumb->DebugMessage('$CanPassThroughDirectly=false because preg_match("#^(f|ht)tps?://#i", '.$
443 } elseif (!@is_readable($phpThumb->sourceFilename)) {
444 …$phpThumb->DebugMessage('$CanPassThroughDirectly=false because !@is_readable('.$phpThumb->sourceFi…
446 } elseif (!@is_file($phpThumb->sourceFilename)) {
447 …$phpThumb->DebugMessage('$CanPassThroughDirectly=false because !@is_file('.$phpThumb->sourceFilena…
459 if (preg_match('#^https?\\://[^\\?&]+\\.(jpe?g|gif|png|webp|avif)$#i', $phpThumb->src)) {
478 …$phpThumb->DebugMessage('$CanPassThroughDirectly=false because $_GET['.implode(';', array_unique($…
483 $phpThumb->DebugTimingMessage('phpThumbDebug[4]', __FILE__, __LINE__);
485 $phpThumb->phpThumbDebug();
489 $phpThumb->DebugMessage('$CanPassThroughDirectly="'. (int) $CanPassThroughDirectly .'" && $phpThumb…
490 while ($CanPassThroughDirectly && $phpThumb->src) {
493 if (preg_match('#^https?\\://[^\\?&]+\.(jpe?g|gif|png|webp|avif)$#i', $phpThumb->src)) {
494 …$phpThumb->DebugMessage('Passing HTTP source through directly as Location: redirect ('.$phpThumb->…
495 header('Location: '.$phpThumb->src);
499 $SourceFilename = $phpThumb->ResolveFilenameToAbsolute($phpThumb->src);
502 if ($phpThumb->getimagesizeinfo = @getimagesize($SourceFilename)) {
503phpThumb->DebugMessage('Direct passthru getimagesize() returned [w='.$phpThumb->getimagesizeinfo[0…
507 …$phpThumb->DebugMessage('Passing "'.$SourceFilename.'" through directly, no resizing required ("'.…
508phpThumb->getimagesizeinfo[0] <= @$_GET['w']) && ($phpThumb->getimagesizeinfo[1] <= @$_GET['h']) &…
510 …$phpThumb->DebugMessage('Passing "'.$SourceFilename.'" through directly, no resizing required ("'.…
512phpThumb->DebugMessage('Not passing "'.$SourceFilename.'" through directly because resizing requir…
515 switch ($phpThumb->getimagesizeinfo[2]) {
525 …$phpThumb->DebugMessage('Not passing "'.$SourceFilename.'" through directly because $phpThumb->get…
536 $theImageCreateFunction = @$ImageCreateFunctions[$phpThumb->getimagesizeinfo[2]];
538 …if ($phpThumb->config_disable_onlycreateable_passthru || (function_exists($theImageCreateFunction)…
546 $phpThumb->ErrorImage('Headers already sent ('.basename(__FILE__).' line '.__LINE__.')');
550 $phpThumb->DebugTimingMessage('skipped direct $SourceFilename passthru', __FILE__, __LINE__);
551 …$phpThumb->DebugMessage('Would have passed "'.$SourceFilename.'" through directly, but skipping du…
555 SendSaveAsFileHeaderIfNeeded($phpThumb->getimagesizeinfo);
557 if ($contentType = phpthumb_functions::ImageTypeToMIMEtype(@$phpThumb->getimagesizeinfo[2])) {
564 …$phpThumb->DebugMessage('Not passing "'.$SourceFilename.'" through directly because ($phpThumb->co…
569 …$phpThumb->DebugMessage('Not passing "'.$SourceFilename.'" through directly because getimagesize()…
577 $phpThumb->DebugTimingMessage('phpThumbDebug[5]', __FILE__, __LINE__);
579 $phpThumb->phpThumbDebug();
584 $phpThumb->SetCacheFilename();
585 if (@is_readable($phpThumb->cache_filename)) {
588 …$phpThumb->DebugMessage('Cached file "'.$phpThumb->cache_filename.'" does not exist, processing as…
593 $phpThumb->DebugTimingMessage('phpThumbDebug[6]', __FILE__, __LINE__);
595 $phpThumb->phpThumbDebug();
599 if ($phpThumb->rawImageData) {
606 if (($phpThumb->w <= 0) || ($phpThumb->h <= 0)) {
607 $phpThumb->ErrorImage('"w" and "h" parameters required for "new"');
611 $phpThumb->ErrorImage('BGcolor parameter for "new" is not valid');
614 …if ($phpThumb->gdimg_source = phpthumb_functions::ImageCreateFunction($phpThumb->w, $phpThumb->h))…
617 $phpThumb->setParameter('is_alpha', true);
618 imagealphablending($phpThumb->gdimg_source, false);
619 imagesavealpha($phpThumb->gdimg_source, true);
621 …$new_background_color = phpthumb_functions::ImageHexColorAllocate($phpThumb->gdimg_source, $bghexc…
622 …imagefilledrectangle($phpThumb->gdimg_source, 0, 0, $phpThumb->w, $phpThumb->h, $new_background_co…
624 $phpThumb->ErrorImage('failed to create "new" image ('.$phpThumb->w.'x'.$phpThumb->h.')');
627 } elseif (!$phpThumb->src) {
629 …$phpThumb->ErrorImage('Usage: '.$_SERVER['PHP_SELF'].'?src=/path/and/filename.jpg'."\n".'read Usag…
634 …$phpThumb->DebugMessage('$phpThumb->src ('.$phpThumb->src.') is remote image, attempting to downlo…
635 if ($phpThumb->config_http_user_agent) {
636 …$phpThumb->DebugMessage('Setting "user_agent" to "'.$phpThumb->config_http_user_agent.'"', __FILE_…
637 ini_set('user_agent', $phpThumb->config_http_user_agent);
639 $cleanedupurl = phpthumb_functions::CleanUpURLencoding($phpThumb->src);
640 …$phpThumb->DebugMessage('CleanUpURLencoding('.$phpThumb->src.') returned "'.$cleanedupurl.'"', __F…
641 $phpThumb->src = $cleanedupurl;
643 …eData = phpthumb_functions::SafeURLread($phpThumb->src, $error, $phpThumb->config_http_fopen_timeo…
644 …$phpThumb->DebugMessage('SafeURLread('.$phpThumb->src.') succeeded'.($error ? ' with messages: "'.…
645 $phpThumb->DebugMessage('Setting source data from URL "'.$phpThumb->src.'"', __FILE__, __LINE__);
646 $phpThumb->setSourceData($rawImageData, urlencode($phpThumb->src));
648 $phpThumb->ErrorImage($error);
651 …$phpThumb->ErrorImage('only FTP and HTTP/HTTPS protocols are allowed, "'.$protocol_matches[1].'" i…
658 $phpThumb->DebugTimingMessage('phpThumbDebug[7]', __FILE__, __LINE__);
660 $phpThumb->phpThumbDebug();
664 $phpThumb->GenerateThumbnail();
668 $phpThumb->DebugTimingMessage('phpThumbDebug[8]', __FILE__, __LINE__);
670 $phpThumb->phpThumbDebug();
674 if (!empty($phpThumb->config_high_security_enabled) && !empty($_GET['nocache'])) {
680 phpthumb_functions::EnsureDirectoryExists(dirname($phpThumb->cache_filename));
681 …if (is_writable(dirname($phpThumb->cache_filename)) || (file_exists($phpThumb->cache_filename) && …
683 $phpThumb->CleanUpCacheDirectory();
684 …if ($phpThumb->RenderToFile($phpThumb->cache_filename) && is_readable($phpThumb->cache_filename)) {
685 chmod($phpThumb->cache_filename, 0644);
688 …$phpThumb->DebugMessage('Failed: RenderToFile('.$phpThumb->cache_filename.')', __FILE__, __LINE__);
693 …$phpThumb->DebugMessage('Cannot write to $phpThumb->cache_filename ('.$phpThumb->cache_filename.')…
701 $phpThumb->DebugTimingMessage('phpThumbDebug[9]', __FILE__, __LINE__);
703 $phpThumb->phpThumbDebug();
707 if (!$phpThumb->OutputThumbnail()) {
708 …$phpThumb->ErrorImage('Error in OutputThumbnail():'."\n". $phpThumb->debugmessages[ count($phpThum…
713 $phpThumb->DebugTimingMessage('phpThumbDebug[10]', __FILE__, __LINE__);
715 $phpThumb->phpThumbDebug();