Changeset 2990259
- Timestamp:
- 11/06/2023 10:11:46 PM (2 years ago)
- File:
-
- 1 edited
-
user-avatar/trunk/user-avatar-pic.php (modified) (37 diffs)
Legend:
- Unmodified
- Added
- Removed
-
user-avatar/trunk/user-avatar-pic.php
r537421 r2990259 4 4 * Based on work done by Tim McDaniels and Darren Hoyt 5 5 * http://code.google.com/p/timthumb/ 6 * 6 * 7 7 * GNU General Public License, version 2 8 8 * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html … … 10 10 * Examples and documentation available on the project homepage 11 11 * http://www.binarymoon.co.uk/projects/timthumb/ 12 * 12 * 13 13 * $Rev$ 14 14 */ … … 21 21 * everytime you download a new version 22 22 */ 23 define ('VERSION', '2.8.1 0'); // Version of this script23 define ('VERSION', '2.8.13'); // Version of this script 24 24 //Load a config file if it exists. Otherwise, use the values below 25 25 if( file_exists(dirname(__FILE__) . '/timthumb-config.php')) require_once('timthumb-config.php'); … … 28 28 if(! defined('MEMORY_LIMIT') ) define ('MEMORY_LIMIT', '30M'); // Set PHP memory limit 29 29 if(! defined('BLOCK_EXTERNAL_LEECHERS') ) define ('BLOCK_EXTERNAL_LEECHERS', false); // If the image or webshot is being loaded on an external site, display a red "No Hotlinking" gif. 30 30 if(! defined('DISPLAY_ERROR_MESSAGES') ) define ('DISPLAY_ERROR_MESSAGES', true); // Display error messages. Set to false to turn off errors (good for production websites) 31 31 //Image fetching and caching 32 32 if(! defined('ALLOW_EXTERNAL') ) define ('ALLOW_EXTERNAL', TRUE); // Allow image fetching from external websites. Will check against ALLOWED_SITES if ALLOW_ALL_EXTERNAL_SITES is false 33 if(! defined('ALLOW_ALL_EXTERNAL_SITES') ) define ('ALLOW_ALL_EXTERNAL_SITES', false); // Less secure. 33 if(! defined('ALLOW_ALL_EXTERNAL_SITES') ) define ('ALLOW_ALL_EXTERNAL_SITES', false); // Less secure. 34 34 if(! defined('FILE_CACHE_ENABLED') ) define ('FILE_CACHE_ENABLED', TRUE); // Should we store resized/modified images on disk to speed things up? 35 if(! defined('FILE_CACHE_TIME_BETWEEN_CLEANS')) define ('FILE_CACHE_TIME_BETWEEN_CLEANS', 86400); // How often the cache is cleaned 35 if(! defined('FILE_CACHE_TIME_BETWEEN_CLEANS')) define ('FILE_CACHE_TIME_BETWEEN_CLEANS', 86400); // How often the cache is cleaned 36 36 37 37 if(! defined('FILE_CACHE_MAX_FILE_AGE') ) define ('FILE_CACHE_MAX_FILE_AGE', 86400); // How old does a file have to be to be deleted from the cache … … 39 39 if(! defined('FILE_CACHE_PREFIX') ) define ('FILE_CACHE_PREFIX', 'timthumb'); // What to put at the beg of all files in the cache directory so we can identify them 40 40 if(! defined('FILE_CACHE_DIRECTORY') ) define ('FILE_CACHE_DIRECTORY', './cache'); // Directory where images are cached. Left blank it will use the system temporary directory (which is better for security) 41 if(! defined('MAX_FILE_SIZE') ) define ('MAX_FILE_SIZE', 10485760); // 10 Megs is 10485760. This is the max internal or external file size that we'll process. 41 if(! defined('MAX_FILE_SIZE') ) define ('MAX_FILE_SIZE', 10485760); // 10 Megs is 10485760. This is the max internal or external file size that we'll process. 42 42 if(! defined('CURL_TIMEOUT') ) define ('CURL_TIMEOUT', 20); // Timeout duration for Curl. This only applies if you have Curl installed and aren't using PHP's default URL fetching mechanism. 43 if(! defined('WAIT_BETWEEN_FETCH_ERRORS') ) define ('WAIT_BETWEEN_FETCH_ERRORS', 3600); // Time to wait between errors fetching remote file43 if(! defined('WAIT_BETWEEN_FETCH_ERRORS') ) define ('WAIT_BETWEEN_FETCH_ERRORS', 3600); // Time to wait between errors fetching remote file 44 44 45 45 //Browser caching … … 48 48 49 49 //Image size and defaults 50 if(! defined('MAX_WIDTH') ) define ('MAX_WIDTH', 1500); // Maximum image width 51 if(! defined('MAX_HEIGHT') ) define ('MAX_HEIGHT', 1500); // Maximum image height 52 if(! defined('NOT_FOUND_IMAGE') ) define ('NOT_FOUND_IMAGE', ''); // Image to serve if any 404 occurs 53 if(! defined('ERROR_IMAGE') ) define ('ERROR_IMAGE', ''); // Image to serve if an error occurs instead of showing error message 54 if(! defined('PNG_IS_TRANSPARENT') ) define ('PNG_IS_TRANSPARENT', FALSE); //42 Define if a png image should have a transparent background color. Use False value if you want to display a custom coloured canvas_colour 55 if(! defined('DEFAULT_Q') ) define ('DEFAULT_Q', 90); // Default image quality. Allows overrid in timthumb-config.php 56 if(! defined('DEFAULT_ZC') ) define ('DEFAULT_ZC', 1); // Default zoom/crop setting. Allows overrid in timthumb-config.php 57 if(! defined('DEFAULT_F') ) define ('DEFAULT_F', ''); // Default image filters. Allows overrid in timthumb-config.php 58 if(! defined('DEFAULT_S') ) define ('DEFAULT_S', 0); // Default sharpen value. Allows overrid in timthumb-config.php 59 if(! defined('DEFAULT_CC') ) define ('DEFAULT_CC', 'ffffff'); // Default canvas colour. Allows overrid in timthumb-config.php 60 50 if(! defined('MAX_WIDTH') ) define ('MAX_WIDTH', 1500); // Maximum image width 51 if(! defined('MAX_HEIGHT') ) define ('MAX_HEIGHT', 1500); // Maximum image height 52 if(! defined('NOT_FOUND_IMAGE') ) define ('NOT_FOUND_IMAGE', ''); // Image to serve if any 404 occurs 53 if(! defined('ERROR_IMAGE') ) define ('ERROR_IMAGE', ''); // Image to serve if an error occurs instead of showing error message 54 if(! defined('PNG_IS_TRANSPARENT') ) define ('PNG_IS_TRANSPARENT', FALSE); // Define if a png image should have a transparent background color. Use False value if you want to display a custom coloured canvas_colour 55 if(! defined('DEFAULT_Q') ) define ('DEFAULT_Q', 90); // Default image quality. Allows overrid in timthumb-config.php 56 if(! defined('DEFAULT_ZC') ) define ('DEFAULT_ZC', 1); // Default zoom/crop setting. Allows overrid in timthumb-config.php 57 if(! defined('DEFAULT_F') ) define ('DEFAULT_F', ''); // Default image filters. Allows overrid in timthumb-config.php 58 if(! defined('DEFAULT_S') ) define ('DEFAULT_S', 0); // Default sharpen value. Allows overrid in timthumb-config.php 59 if(! defined('DEFAULT_CC') ) define ('DEFAULT_CC', 'ffffff'); // Default canvas colour. Allows overrid in timthumb-config.php 60 if(! defined('DEFAULT_WIDTH') ) define ('DEFAULT_WIDTH', 100); // Default thumbnail width. Allows overrid in timthumb-config.php 61 if(! defined('DEFAULT_HEIGHT') ) define ('DEFAULT_HEIGHT', 100); // Default thumbnail height. Allows overrid in timthumb-config.php 62 63 /** 64 * Additional Parameters: 65 * LOCAL_FILE_BASE_DIRECTORY = Override the DOCUMENT_ROOT. This is best used in timthumb-config.php 66 */ 61 67 62 68 //Image compression is enabled if either of these point to valid paths 63 69 64 //These are now disabled by default because the file sizes of PNGs (and GIFs) are much smaller than we used to generate. 70 //These are now disabled by default because the file sizes of PNGs (and GIFs) are much smaller than we used to generate. 65 71 //They only work for PNGs. GIFs and JPEGs are not affected. 66 if(! defined('OPTIPNG_ENABLED') ) define ('OPTIPNG_ENABLED', false); 67 if(! defined('OPTIPNG_PATH') ) define ('OPTIPNG_PATH', '/usr/bin/optipng'); //This will run first because it gives better compression than pngcrush. 68 if(! defined('PNGCRUSH_ENABLED') ) define ('PNGCRUSH_ENABLED', false); 72 if(! defined('OPTIPNG_ENABLED') ) define ('OPTIPNG_ENABLED', false); 73 if(! defined('OPTIPNG_PATH') ) define ('OPTIPNG_PATH', '/usr/bin/optipng'); //This will run first because it gives better compression than pngcrush. 74 if(! defined('PNGCRUSH_ENABLED') ) define ('PNGCRUSH_ENABLED', false); 69 75 if(! defined('PNGCRUSH_PATH') ) define ('PNGCRUSH_PATH', '/usr/bin/pngcrush'); //This will only run if OPTIPNG_PATH is not set or is not valid 70 76 71 77 /* 72 78 -------====Website Screenshots configuration - BETA====------- 73 74 If you just want image thumbnails and don't want website screenshots, you can safely leave this as is. 75 79 80 If you just want image thumbnails and don't want website screenshots, you can safely leave this as is. 81 76 82 If you would like to get website screenshots set up, you will need root access to your own server. 77 83 … … 92 98 10. http://yoursite.com/path/to/timthumb.php?src=http://markmaunder.com/&webshot=1 93 99 94 Notes on performance: 100 Notes on performance: 95 101 The first time a webshot loads, it will take a few seconds. 96 102 From then on it uses the regular timthumb caching mechanism with the configurable options above … … 100 106 If you'd like a slight speedup (about 25%) and you know Linux, you can run the following command which will keep Xvfb running in the background. 101 107 nohup Xvfb :100 -ac -nolisten tcp -screen 0, 1024x768x24 > /dev/null 2>&1 & 102 Then set WEBSHOT_XVFB_RUNNING = true below. This will save your server having to fire off a new Xvfb server and shut it down every time a new shot is generated. 108 Then set WEBSHOT_XVFB_RUNNING = true below. This will save your server having to fire off a new Xvfb server and shut it down every time a new shot is generated. 103 109 You will need to take responsibility for keeping Xvfb running in case it crashes. (It seems pretty stable) 104 You will also need to take responsibility for server security if you're running Xvfb as root. 110 You will also need to take responsibility for server security if you're running Xvfb as root. 105 111 106 112 107 113 */ 108 114 if(! defined('WEBSHOT_ENABLED') ) define ('WEBSHOT_ENABLED', false); //Beta feature. Adding webshot=1 to your query string will cause the script to return a browser screenshot rather than try to fetch an image. 109 if(! defined('WEBSHOT_CUTYCAPT') ) define ('WEBSHOT_CUTYCAPT', '/usr/local/bin/CutyCapt'); //The path to CutyCapt. 115 if(! defined('WEBSHOT_CUTYCAPT') ) define ('WEBSHOT_CUTYCAPT', '/usr/local/bin/CutyCapt'); //The path to CutyCapt. 110 116 if(! defined('WEBSHOT_XVFB') ) define ('WEBSHOT_XVFB', '/usr/bin/xvfb-run'); //The path to the Xvfb server 111 117 if(! defined('WEBSHOT_SCREEN_X') ) define ('WEBSHOT_SCREEN_X', '1024'); //1024 works ok … … 118 124 if(! defined('WEBSHOT_JAVA_ON') ) define ('WEBSHOT_JAVA_ON', false); //Have only tested this as fase 119 125 if(! defined('WEBSHOT_PLUGINS_ON') ) define ('WEBSHOT_PLUGINS_ON', true); //Enable flash and other plugins 120 if(! defined('WEBSHOT_PROXY') ) define ('WEBSHOT_PROXY', ''); //In case you're behind a proxy server. 126 if(! defined('WEBSHOT_PROXY') ) define ('WEBSHOT_PROXY', ''); //In case you're behind a proxy server. 121 127 if(! defined('WEBSHOT_XVFB_RUNNING') ) define ('WEBSHOT_XVFB_RUNNING', false); //ADVANCED: Enable this if you've got Xvfb running in the background. 122 128 123 129 124 // If ALLOW_EXTERNAL is true and ALLOW_ALL_EXTERNAL_SITES is false, then external images will only be fetched from these domains and their subdomains. 130 // If ALLOW_EXTERNAL is true and ALLOW_ALL_EXTERNAL_SITES is false, then external images will only be fetched from these domains and their subdomains. 125 131 if(! isset($ALLOWED_SITES)){ 126 132 $ALLOWED_SITES = array ( … … 198 204 } 199 205 $this->cacheDirectory = FILE_CACHE_DIRECTORY; 200 if ( !touch($this->cacheDirectory . '/index.html')) {206 if ( ! is_writable( $this->cacheDirectory . '/index.html' ) || ! touch( $this->cacheDirectory . '/index.html' ) ) { 201 207 $this->error("Could not create the index.html file - to fix this create an empty file named index.html file in the cache directory."); 202 208 } … … 204 210 $this->cacheDirectory = sys_get_temp_dir(); 205 211 } 206 //Clean the cache before we do anything because we don't want the first visitor after FILE_CACHE_TIME_BETWEEN_CLEANS expires to get a stale image. 212 //Clean the cache before we do anything because we don't want the first visitor after FILE_CACHE_TIME_BETWEEN_CLEANS expires to get a stale image. 207 213 $this->cleanCache(); 208 214 209 215 $this->myHost = preg_replace('/^www\./i', '', $_SERVER['HTTP_HOST']); 210 216 $this->src = $this->param('src'); 211 217 $this->url = parse_url($this->src); 212 218 $this->src = preg_replace('/https?:\/\/(?:www\.)?' . $this->myHost . '/i', '', $this->src); 213 219 214 220 if(strlen($this->src) <= 3){ 215 221 $this->error("No image specified"); … … 221 227 $imgData = base64_decode("R0lGODlhUAAMAIAAAP8AAP///yH5BAAHAP8ALAAAAABQAAwAAAJpjI+py+0Po5y0OgAMjjv01YUZ\nOGplhWXfNa6JCLnWkXplrcBmW+spbwvaVr/cDyg7IoFC2KbYVC2NQ5MQ4ZNao9Ynzjl9ScNYpneb\nDULB3RP6JuPuaGfuuV4fumf8PuvqFyhYtjdoeFgAADs="); 222 228 header('Content-Type: image/gif'); 223 header('Content-Length: ' . s izeof($imgData));229 header('Content-Length: ' . strlen($imgData)); 224 230 header('Cache-Control: no-store, no-cache, must-revalidate, max-age=0'); 225 231 header("Pragma: no-cache"); … … 312 318 } 313 319 protected function handleErrors(){ 314 if($this->haveErrors()){ 320 if($this->haveErrors()){ 315 321 if(NOT_FOUND_IMAGE && $this->is404()){ 316 322 if($this->serveImg(NOT_FOUND_IMAGE)){ … … 327 333 } 328 334 } 329 $this->serveErrors(); 330 exit(0); 335 $this->serveErrors(); 336 exit(0); 331 337 } 332 338 return false; … … 386 392 $this->set404(); 387 393 $this->error("An error occured fetching image."); 388 return false; 394 return false; 389 395 } 390 396 } … … 417 423 protected function serveErrors(){ 418 424 header ($_SERVER['SERVER_PROTOCOL'] . ' 400 Bad Request'); 425 if ( ! DISPLAY_ERROR_MESSAGES ) { 426 return; 427 } 419 428 $html = '<ul>'; 420 429 foreach($this->errors as $err){ … … 423 432 $html .= '</ul>'; 424 433 echo '<h1>A TimThumb error has occured</h1>The following error(s) occured:<br />' . $html . '<br />'; 425 echo '<br />Query String : ' . htmlentities ($_SERVER['QUERY_STRING']);434 echo '<br />Query String : ' . htmlentities( $_SERVER['QUERY_STRING'], ENT_QUOTES ); 426 435 echo '<br />TimThumb version : ' . VERSION . '</pre>'; 427 436 } … … 445 454 $this->serveCacheFile(); 446 455 return true; 447 } else { 456 } else { 448 457 return false; 449 458 } … … 455 464 $this->debug(3, "cleanCache() called"); 456 465 $lastCleanFile = $this->cacheDirectory . '/timthumb_cacheLastCleanTime.touch'; 457 466 458 467 //If this is a new timthumb installation we need to create the file 459 468 if(! is_file($lastCleanFile)){ … … 467 476 $this->debug(1, "Cache was last cleaned more than " . FILE_CACHE_TIME_BETWEEN_CLEANS . " seconds ago. Cleaning now."); 468 477 // Very slight race condition here, but worst case we'll have 2 or 3 servers cleaning the cache simultaneously once a day. 469 if ( !touch($lastCleanFile)) {478 if ( ! is_writable( $lastCleanFile ) || ! touch( $lastCleanFile ) ) { 470 479 $this->error("Could not create cache clean timestamp file."); 471 480 } … … 516 525 } 517 526 518 // get standard input properties 527 // get standard input properties 519 528 $new_width = (int) abs ($this->param('w', 0)); 520 529 $new_height = (int) abs ($this->param('h', 0)); … … 529 538 // set default width and height if neither are set already 530 539 if ($new_width == 0 && $new_height == 0) { 531 $new_width = 100;532 $new_height = 100;540 $new_width = (int) DEFAULT_WIDTH; 541 $new_height = (int) DEFAULT_HEIGHT; 533 542 } 534 543 … … 577 586 578 587 if (strlen($canvas_color) == 3) { //if is 3-char notation, edit string into 6-char notation 579 $canvas_color = str_repeat(substr($canvas_color, 0, 1), 2) . str_repeat(substr($canvas_color, 1, 1), 2) . str_repeat(substr($canvas_color, 2, 1), 2); 588 $canvas_color = str_repeat(substr($canvas_color, 0, 1), 2) . str_repeat(substr($canvas_color, 1, 1), 2) . str_repeat(substr($canvas_color, 2, 1), 2); 580 589 } else if (strlen($canvas_color) != 6) { 581 590 $canvas_color = DEFAULT_CC; // on error return default canvas color … … 587 596 588 597 // Create a new transparent color for image 589 // If is a png and PNG_IS_TRANSPARENT is false then remove the alpha transparency 598 // If is a png and PNG_IS_TRANSPARENT is false then remove the alpha transparency 590 599 // (and if is set a canvas color show it in the background) 591 if(preg_match('/^image\/png$/i', $mimeType) && !PNG_IS_TRANSPARENT && $canvas_trans){ 592 $color = imagecolorallocatealpha ($canvas, $canvas_color_R, $canvas_color_G, $canvas_color_B, 127); 600 if(preg_match('/^image\/png$/i', $mimeType) && !PNG_IS_TRANSPARENT && $canvas_trans){ 601 $color = imagecolorallocatealpha ($canvas, $canvas_color_R, $canvas_color_G, $canvas_color_B, 127); 593 602 }else{ 594 603 $color = imagecolorallocatealpha ($canvas, $canvas_color_R, $canvas_color_G, $canvas_color_B, 0); … … 740 749 $imgType = ""; 741 750 $tempfile = tempnam($this->cacheDirectory, 'timthumb_tmpimg_'); 742 if(preg_match('/^image\/(?:jpg|jpeg)$/i', $mimeType)){ 751 if(preg_match('/^image\/(?:jpg|jpeg)$/i', $mimeType)){ 743 752 $imgType = 'jpg'; 744 imagejpeg($canvas, $tempfile, $quality); 745 } else if(preg_match('/^image\/png$/i', $mimeType)){ 753 imagejpeg($canvas, $tempfile, $quality); 754 } else if(preg_match('/^image\/png$/i', $mimeType)){ 746 755 $imgType = 'png'; 747 756 imagepng($canvas, $tempfile, floor($quality * 0.09)); … … 795 804 $context = stream_context_create (); 796 805 $fp = fopen($tempfile,'r',0,$context); 797 file_put_contents($tempfile4, $this->filePrependSecurityBlock . $imgType . ' ?' . '>'); //6 extra bytes, first 3 being image type 806 file_put_contents($tempfile4, $this->filePrependSecurityBlock . $imgType . ' ?' . '>'); //6 extra bytes, first 3 being image type 798 807 file_put_contents($tempfile4, $fp, FILE_APPEND); 799 808 fclose($fp); … … 825 834 $docRoot = @$_SERVER['DOCUMENT_ROOT']; 826 835 if (defined('LOCAL_FILE_BASE_DIRECTORY')) { 827 $docRoot = LOCAL_FILE_BASE_DIRECTORY; 828 } 829 if(!isset($docRoot)){ 836 $docRoot = LOCAL_FILE_BASE_DIRECTORY; 837 } 838 if(!isset($docRoot)){ 830 839 $this->debug(3, "DOCUMENT_ROOT is not set. This is probably windows. Starting search 1."); 831 840 if(isset($_SERVER['SCRIPT_FILENAME'])){ 832 841 $docRoot = str_replace( '\\', '/', substr($_SERVER['SCRIPT_FILENAME'], 0, 0-strlen($_SERVER['PHP_SELF']))); 833 842 $this->debug(3, "Generated docRoot using SCRIPT_FILENAME and PHP_SELF as: $docRoot"); 834 } 835 } 836 if(!isset($docRoot)){ 843 } 844 } 845 if(!isset($docRoot)){ 837 846 $this->debug(3, "DOCUMENT_ROOT still is not set. Starting search 2."); 838 847 if(isset($_SERVER['PATH_TRANSLATED'])){ 839 848 $docRoot = str_replace( '\\', '/', substr(str_replace('\\\\', '\\', $_SERVER['PATH_TRANSLATED']), 0, 0-strlen($_SERVER['PHP_SELF']))); 840 849 $this->debug(3, "Generated docRoot using PATH_TRANSLATED and PHP_SELF as: $docRoot"); 841 } 850 } 842 851 } 843 852 if($docRoot && $_SERVER['DOCUMENT_ROOT'] != '/'){ $docRoot = preg_replace('/\/$/', '', $docRoot); } … … 856 865 } 857 866 return $this->error("Could not find your website document root and the file specified doesn't exist in timthumbs directory. We don't support serving files outside timthumb's directory without a document root for security reasons."); 858 } //Do not go past this point without docRoot set 867 } else if ( ! is_dir( $this->docRoot ) ) { 868 $this->error("Server path does not exist. Ensure variable \$_SERVER['DOCUMENT_ROOT'] is set correctly"); 869 } 870 871 //Do not go past this point without docRoot set 859 872 860 873 //Try src under docRoot … … 881 894 } 882 895 } 883 896 884 897 $base = $this->docRoot; 885 898 886 899 // account for Windows directory structure 887 900 if (strstr($_SERVER['SCRIPT_FILENAME'],':')) { … … 948 961 } 949 962 $url = preg_replace('/[^A-Za-z0-9\-\.\_\~:\/\?\#\[\]\@\!\$\&\'\(\)\*\+\,\;\=]+/', '', $url); //RFC 3986 950 //Very important we don't allow injection of shell commands here. URL is between quotes and we are only allowing through chars allowed by a the RFC 951 // which AFAIKT can't be used for shell injection. 963 //Very important we don't allow injection of shell commands here. URL is between quotes and we are only allowing through chars allowed by a the RFC 964 // which AFAIKT can't be used for shell injection. 952 965 if(WEBSHOT_XVFB_RUNNING){ 953 966 putenv('DISPLAY=:100.0'); … … 993 1006 @unlink($this->cachefile); 994 1007 touch($this->cachefile); 995 $this->error("The remote file is not a valid image. ");1008 $this->error("The remote file is not a valid image. Mimetype = '" . $mimeType . "'" . $tempfile); 996 1009 return false; 997 1010 } … … 1088 1101 case 'image/png': 1089 1102 $image = imagecreatefrompng ($src); 1103 imagealphablending( $image, true ); 1104 imagesavealpha( $image, true ); 1090 1105 break; 1091 1106 … … 1093 1108 $image = imagecreatefromgif ($src); 1094 1109 break; 1095 1110 1096 1111 default: 1097 1112 $this->error("Unrecognised mimeType"); … … 1104 1119 $ff = @$_SERVER["HTTP_X_FORWARDED_FOR"]; 1105 1120 $ci = @$_SERVER["HTTP_CLIENT_IP"]; 1106 if(preg_match('/^(?:192\.168|172\.16|10\.|127\.)/', $rem)){ 1121 if(preg_match('/^(?:192\.168|172\.16|10\.|127\.)/', $rem)){ 1107 1122 if($ff){ return $ff; } 1108 1123 if($ci){ return $ci; } … … 1156 1171 } 1157 1172 } 1173 1158 1174 protected function getURL($url, $tempfile){ 1159 1175 $this->lastURLError = false; … … 1177 1193 @curl_setopt ($curl, CURLOPT_FOLLOWLOCATION, true); 1178 1194 @curl_setopt ($curl, CURLOPT_MAXREDIRS, 10); 1179 1195 1180 1196 $curlResult = curl_exec($curl); 1181 1197 fclose(self::$curlFH); … … 1183 1199 if($httpStatus == 404){ 1184 1200 $this->set404(); 1201 } 1202 if($httpStatus == 302){ 1203 $this->error("External Image is Redirecting. Try alternate image url"); 1204 return false; 1185 1205 } 1186 1206 if($curlResult){
Note: See TracChangeset
for help on using the changeset viewer.