[ Index ]

PHP Cross Reference of Limb3

title

Body

[close]

/wysiwyg/shared/tiny_mce/plugins/ibrowser/scripts/phpThumb/demo/ -> phpThumb.demo.check.php (source)

   1  <?php
   2  //////////////////////////////////////////////////////////////
   3  ///  phpThumb() by James Heinrich <info@silisoftware.com>   //
   4  //        available at http://phpthumb.sourceforge.net     ///
   5  //////////////////////////////////////////////////////////////
   6  ///                                                         //
   7  // phpThumb.demo.check.php                                  //
   8  // James Heinrich <info@silisoftware.com>                   //
   9  //                                                          //
  10  // Configuration analyzer for phpThumb settings and server  //
  11  // settings that may affect phpThumb performance            //
  12  // Live demo is at http://phpthumb.sourceforge.net/demo/    //
  13  //                                                          //
  14  //////////////////////////////////////////////////////////////
  15  
  16  $ServerInfo['gd_string']  = 'unknown';
  17  $ServerInfo['gd_numeric'] = 0;
  18  //ob_start();
  19  if (!include_once ('../phpthumb.functions.php')) {
  20      ob_end_flush();
  21      die('failed to include_once ("../phpthumb.functions.php")');
  22  }
  23  if (!include_once ('../phpthumb.class.php')) {
  24      //ob_end_flush();
  25      die('failed to include_once ("../phpthumb.class.php")');
  26  }
  27  //ob_end_clean();
  28  $phpThumb = new phpThumb();
  29  if (include_once ('../phpThumb.config.php')) {
  30      foreach ($PHPTHUMB_CONFIG as $key => $value) {
  31          $keyname = 'config_'.$key;
  32          $phpThumb->setParameter($keyname, $value);
  33      }
  34  }
  35  
  36  $ServerInfo['gd_string']  = phpthumb_functions::gd_version(true);
  37  $ServerInfo['gd_numeric'] = phpthumb_functions::gd_version(false);
  38  $ServerInfo['im_version'] = $phpThumb->ImageMagickVersion();
  39  $gd_info                  = gd_info();
  40  
  41  ?>
  42  
  43  <html>
  44  <head>
  45      <title>phpThumb configuration analyzer</title>
  46      <link rel="stylesheet" type="text/css" href="/style.css" title="style sheet">
  47  </head>
  48  <body bgcolor="#CCCCCC">
  49  
  50  This demo analyzes your settings (phpThumb.config.php and server/PHP) for <a href="http://phpthumb.sourceforge.net"><b>phpThumb()</b></a>.<br>
  51  <br>
  52  <table border="1">
  53      <tr><th colspan="8">&lt;-- bad . . . . . good --&gt;</th></tr>
  54      <tr>
  55          <td bgcolor="red">&nbsp;&nbsp;&nbsp;&nbsp;</td>
  56          <td bgcolor="orange">&nbsp;&nbsp;&nbsp;&nbsp;</td>
  57          <td bgcolor="yellow">&nbsp;&nbsp;&nbsp;&nbsp;</td>
  58          <td bgcolor="olive">&nbsp;&nbsp;&nbsp;&nbsp;</td>
  59          <td bgcolor="darkgreen">&nbsp;&nbsp;&nbsp;&nbsp;</td>
  60          <td bgcolor="green">&nbsp;&nbsp;&nbsp;&nbsp;</td>
  61          <td bgcolor="lightgreen">&nbsp;&nbsp;&nbsp;&nbsp;</td>
  62          <td bgcolor="lime">&nbsp;&nbsp;&nbsp;&nbsp;</td>
  63      </tr>
  64  </table>
  65  <table border="1" cellspacing="0" cellpadding="2">
  66  <tr bgcolor="#EEEEEE"><th>Setting</th><th colspan="2">Value</th><th>Comments</th></tr>
  67  <?php
  68  
  69  $versions['raw'] = array(
  70      'latest' => phpthumb_functions::SafeURLread('http://phpthumb.sourceforge.net/?latestversion=1', $dummy),
  71      'this'   => $phpThumb->phpthumb_version,
  72  );
  73  foreach ($versions['raw'] as $key => $value) {
  74      eregi('^([0-9\.]+)\-?(([0-9]{4})([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2}))?', $value, $matches);
  75      @list($huge, $major, $minor) = @explode('.', @$matches[1]);
  76      @list($year, $month, $day, $hour, $min) = @$matches[3];
  77      $versions['base'][$key]  = $matches[1];
  78      $versions['huge'][$key]  = $huge;
  79      $versions['major'][$key] = $major;
  80      $versions['minor'][$key] = $minor;
  81      $versions['stamp'][$key] = $matches[2];
  82      $versions['year'][$key]  = $year;
  83      $versions['month'][$key] = $month;
  84      $versions['day'][$key]   = $day;
  85      $versions['hour'][$key]  = $hour;
  86      $versions['min'][$key]   = $min;
  87      $versions['date'][$key]  = @mktime($hour, $min, 0, $month, $day, $year);
  88  }
  89  
  90  $downloadlatest = 'Download the latest version from <a href="http://phpthumb.sourceforge.net">http://phpthumb.sourceforge.net</a>';
  91  echo '<tr><th nowrap>Latest phpThumb version:</th><th colspan="2">'.$versions['raw']['latest'].'</th><td>'.$downloadlatest.'</td></tr>';
  92  echo '<tr><th nowrap>This phpThumb version:</th><th colspan="2" bgcolor="';
  93  
  94  if (!$versions['base']['latest']) {
  95      // failed to get latest version number
  96      echo 'white';
  97      $message = 'Latest version unknown.<br>'.$downloadlatest;
  98  } elseif (phpthumb_functions::version_compare_replacement($versions['base']['this'], $versions['base']['latest'], '>')) {
  99      // new than latest, must be beta version
 100      echo 'lightblue';
 101      $message = 'This must be a pre-release beta version. Please report bugs to <a href="mailto:info@silisoftware.com">info@silisoftware.com</a>';
 102  } elseif (($versions['base']['latest'] == $versions['base']['this']) && ($versions['stamp']['this'] > $versions['stamp']['latest'])) {
 103      // new than latest, must be beta version
 104      echo 'lightblue';
 105      $message = 'You must be using a pre-release beta version. Please report bugs to <a href="mailto:info@silisoftware.com">info@silisoftware.com</a>';
 106  } elseif ($versions['base']['latest'] == $versions['base']['this']) {
 107      // latest version
 108      echo 'lime';
 109      $message = 'You are using the latest released version.';
 110  } elseif ($versions['huge']['latest'].$versions['major']['latest'] == $versions['huge']['this'].$versions['major']['this']) {
 111      echo 'olive';
 112      $message = 'One (or more) minor version(s) have been released since this version.<br>'.$downloadlatest;
 113  } elseif (floatval($versions['huge']['latest'].str_pad($versions['major']['latest'], 2, '0', STR_PAD_LEFT)) < floatval($versions['huge']['this'].str_pad($t_major, 2, '0', STR_PAD_LEFT))) {
 114      echo 'yellow';
 115      $message = 'One (or more) major version(s) have been released since this version, you really should upgrade.<br>'.$downloadlatest;
 116  } else {
 117      echo 'orange';
 118      $message = 'Fundamental changes have been made since this version.<br>'.$downloadlatest;
 119  }
 120  echo '">'.$phpThumb->phpthumb_version;
 121  echo '</th><td>'.$message.'.<br></td></tr>';
 122  
 123  
 124  echo '<tr><th>phpThumb.config.php:</th><th colspan="2" bgcolor="';
 125  if (file_exists('../phpThumb.config.php') && !file_exists('../phpThumb.config.php.default')) {
 126      echo 'lime">"phpThumb.config.php" exists and "phpThumb.config.php.default" does not';
 127  } elseif (file_exists('../phpThumb.config.php') && file_exists('../phpThumb.config.php.default')) {
 128      echo 'yellow">"phpThumb.config.php" and "phpThumb.config.php.default" both exist';
 129  } elseif (!file_exists('../phpThumb.config.php') && file_exists('../phpThumb.config.php.default')) {
 130      echo 'yellow">rename "phpThumb.config.php.default" to "phpThumb.config.php"';
 131  } else {
 132      echo 'yellow">"phpThumb.config.php" not found (nor "phpThumb.config.php")';
 133  }
 134  echo '</th><td>"phpThumb.config.php.default" that comes in the distribution must be renamed to "phpThumb.config.php" before phpThumb.php can be used. Avoid having both files present to minimize confusion.</td></tr>';
 135  
 136  
 137  echo '<tr><th>cache directory:</th><th colspan="2">';
 138  $orig_config_cache_directory = $phpThumb->config_cache_directory;
 139  $phpThumb->setCacheDirectory();
 140  echo '<div style="background-color: '.(     is_dir($phpThumb->config_cache_directory) ? 'lime;">exists' : 'red;">does NOT exist').'</div>';
 141  echo '<div style="background-color: '.(is_readable($phpThumb->config_cache_directory) ? 'lime;">readable' : 'red;">NOT readable').'</div>';
 142  echo '<div style="background-color: '.(is_writable($phpThumb->config_cache_directory) ? 'lime;">writable' : 'red;">NOT writable').'</div>';
 143  echo '</th><td>Original: "'.htmlentities($orig_config_cache_directory).'"<br>Resolved: "'.htmlentities($phpThumb->config_cache_directory).'"<br>Must exist and be both readable and writable by PHP.</td></tr>';
 144  
 145  
 146  echo '<tr><th>temp directory:</th><th colspan="2">';
 147  $orig_config_temp_directory = $phpThumb->config_temp_directory;
 148  $phpThumb->phpThumb_tempnam();
 149  echo '<div style="background-color: '.(     is_dir($phpThumb->config_temp_directory) ? 'lime;">exists' : 'red;">does NOT exist').'</div>';
 150  echo '<div style="background-color: '.(is_readable($phpThumb->config_temp_directory) ? 'lime;">readable' : 'red;">NOT readable').'</div>';
 151  echo '<div style="background-color: '.(is_writable($phpThumb->config_temp_directory) ? 'lime;">writable' : 'red;">NOT writable').'</div>';
 152  echo '</th><td>Original: "'.htmlentities($orig_config_temp_directory).'"<br>Resolved: "'.htmlentities($phpThumb->config_temp_directory).'"<br>Must exist and be both readable and writable by PHP.</td></tr>';
 153  
 154  
 155  echo '<tr><th>PHP version:</th><th colspan="2" bgcolor="';
 156  if (phpthumb_functions::version_compare_replacement(phpversion(), '5.0.0', '>=')) {
 157      echo 'lime';
 158  } elseif (phpthumb_functions::version_compare_replacement(phpversion(), '4.3.3', '>=')) {
 159      echo 'lightgreen';
 160  } elseif (phpthumb_functions::version_compare_replacement(phpversion(), '4.2.0', '>=')) {
 161      echo 'green';
 162  } elseif (phpthumb_functions::version_compare_replacement(phpversion(), '4.1.0', '>=')) {
 163      echo 'yellow';
 164  } elseif (phpthumb_functions::version_compare_replacement(phpversion(), '4.0.6', '>=')) {
 165      echo 'orange';
 166  } else {
 167      echo 'red';
 168  }
 169  echo '">'.phpversion();
 170  echo '</th><td>PHP5 is ideal (support for numerous built-in filters which are much faster than my code).<br>PHP v4.3.2+ supports ImageSaveAlpha which is required for proper PNG/ICO output.<br>ImageRotate requires PHP v4.3.0+ (but buggy before v4.3.3).<br>EXIF thumbnail extraction requires PHP v4.2.0+.<br>Most things will work back to PHP v4.1.0, and mostly (perhaps buggy) back to v4.0.6, but no guarantees for any version older than that.</td></tr>';
 171  
 172  
 173  echo '<tr><th>GD version:</th><th colspan="2" bgcolor="';
 174  if ($ServerInfo['gd_numeric'] >= 2) {
 175      if (eregi('bundled', @$ServerInfo['gd_string'])) {
 176          echo 'lime';
 177      } else {
 178          echo 'yellow';
 179      }
 180  } elseif ($ServerInfo['im_version']) {
 181      echo 'orange';
 182  } else {
 183      echo 'red';
 184  }
 185  echo '">'.@$ServerInfo['gd_string'];
 186  echo '</th><td>GD2-bundled version is ideal.<br>GD2 (non-bundled) is second choice, but there are a number of bugs in the non-bundled version. ImageRotate is only available in the bundled version of GD2.<br>GD1 will also (mostly) work, at much-reduced image quality and several features disabled. phpThumb can perform most operations with ImageMagick only, even if GD is not available.</td></tr>';
 187  
 188  
 189  echo '<tr><th>ImageMagick version:</th><th colspan="2" bgcolor="';
 190  if ($ServerInfo['im_version']) {
 191      echo 'lime';
 192  } elseif (@$ServerInfo['gd_string']) {
 193      echo 'orange';
 194  } else {
 195      echo 'red';
 196  }
 197  echo '">"'.$phpThumb->ImageMagickCommandlineBase().'"<br>'.($ServerInfo['im_version'] ? $ServerInfo['im_version'] : 'n/a');
 198  echo '</th><td>ImageMagick is faster than GD, can process larger images without PHP memory_limit issues, can resize animated GIFs. phpThumb can perform most operations with ImageMagick only, even if GD is not available.</td></tr>';
 199  
 200  
 201  echo '<tr><th>ImageMagick features:</th><th colspan="2">';
 202  $GDfeatures['red']    = array('version', 'help', 'thumbnail', 'crop', 'repage', 'coalesce', 'gravity', 'background', 'interlace', 'flatten', 'border', 'bordercolor', 'dither', 'quality');
 203  $GDfeatures['orange'] = array('blur', 'colorize', 'colors', 'colorspace', 'contrast', 'edge', 'emboss', 'fill', 'flip', 'flop', 'gamma', 'gaussian', 'level', 'modulate', 'monochrome', 'negate', 'normalize', 'sepia-tone', 'threshold', 'unsharp');
 204  foreach ($GDfeatures as $missingcolor => $features) {
 205      foreach ($features as $dummy => $feature) {
 206          echo ' <span style="background-color: '.($phpThumb->ImageMagickSwitchAvailable($feature) ? 'lime' : $missingcolor).';">'.htmlentities($feature).' | </span>';
 207      }
 208  }
 209  echo '</th><td>All of these parameters may be called by phpThumb, depending on parameters used.  Green means the feature is available; red means a critical feature is missing; orange means an optional filter/feature is missing.</td></tr>';
 210  
 211  
 212  echo '<tr><th>GD features:</th><th colspan="2">';
 213  $GDfeatures['red']    = array('JPG Support', 'PNG Support');
 214  $GDfeatures['orange'] = array('GIF Read Support', 'GIF Create Support', 'FreeType Support');
 215  foreach ($GDfeatures as $missingcolor => $features) {
 216      foreach ($features as $dummy => $feature) {
 217          echo '<div style="background-color: '.($gd_info[$feature] ? 'lime' : $missingcolor).';">'.htmlentities($feature).'</div>';
 218      }
 219  }
 220  echo '</th><td>PNG support is required for watermarks, overlays, calls to ImageMagick and other internal operations.<br>JPG support is obviously quite useful, but ImageMagick can substitute<br>GIF read support can be bypassed with ImageMagick and/or internal GIF routines.<br>GIF create support can be bypassed with ImageMagick (if no filters are applied)<br>FreeType support is needed for TTF overlays.</td></tr>';
 221  
 222  
 223  echo '<tr><th>GD extension "EXIF"</th><th colspan="2" bgcolor="';
 224  if (extension_loaded('exif')) {
 225      echo 'lime';
 226  } elseif (@$ServerInfo['gd_string']) {
 227      echo 'orange';
 228  }
 229  echo '">'.(extension_loaded('exif') ? 'TRUE' : 'FALSE');
 230  echo '</th><td>EXIF extension required for auto-rotate images. Also required to extract EXIF thumbnail to use as source if source image is too large for PHP memory_limit and ImageMagick is unavailable.</td></tr>';
 231  
 232  
 233  echo '<tr><th>php_sapi_name()</th><th colspan="2" bgcolor="';
 234  $php_sapi_name = strtolower(function_exists('php_sapi_name') ? php_sapi_name() : '');
 235  if (!$php_sapi_name) {
 236      echo 'red';
 237  } elseif ($php_sapi_name == 'cgi-fcgi') {
 238      echo 'orange';
 239  } elseif ($php_sapi_name == 'cgi') {
 240      echo 'yellow';
 241  } elseif ($php_sapi_name == 'apache') {
 242      echo 'lime';
 243  } else {
 244      echo 'green';
 245  }
 246  echo '">'.$php_sapi_name.'</th>';
 247  echo '<td>SAPI mode preferred to CGI mode. FCGI mode has unconfirmed strange behavior (notably more than one space in "wmt" filter text causes errors). If not working in "apache" (SAPI) mode, <i>apache_lookup_uri()</i> will not work.</td></tr>';
 248  
 249  
 250  echo '<tr><th>Server Software</th><th colspan="2" bgcolor="';
 251  $server_software = getenv('SERVER_SOFTWARE');
 252  if (!$server_software) {
 253      echo 'red';
 254  } elseif (eregi('^Apache/([0-9\.]+)', $server_software, $matches)) {
 255      if (phpthumb_functions::version_compare_replacement($matches[1], '2.0.0', '>=')) {
 256          echo 'lightgreen';
 257      } else {
 258          echo 'lime';
 259      }
 260  } else {
 261      echo 'darkgreen';
 262  }
 263  echo '">'.$server_software.'</th>';
 264  echo '<td>Apache v1.x has the fewest compatability problems. IIS has numerous annoyances. Apache v2.x is broken when lookup up <i>/~user/filename.jpg</i> style relative filenames using <i>apache_lookup_uri()</i>.</td></tr>';
 265  
 266  
 267  echo '<tr><th>curl_version:</th><th colspan="2" bgcolor="';
 268  $curl_version = (function_exists('curl_version') ? curl_version() : '');
 269  if (is_array($curl_version)) {
 270      $curl_version = @$curl_version['version'];
 271  }
 272  if ($curl_version) {
 273      echo 'lime';
 274  } else {
 275      echo 'yellow';
 276  }
 277  echo '">'.$curl_version.'</th>';
 278  echo '<td>Best if available. HTTP source images will be unavailable if CURL unavailable and <i>allow_url_fopen</i> is also disabled.</td></tr>';
 279  
 280  echo '<tr bgcolor="#EEEEEE"><th colspan="4">&nbsp;</th></tr>';
 281  echo '<tr bgcolor="#EEEEEE"><th>function_exists:</th><th colspan="2">Value</th><th>Comments</th></tr>';
 282  
 283  $FunctionsExist = array(
 284      'ImageRotate'           => array('orange',     'required for "ra" and "ar" filters.'),
 285      'exif_read_data'        => array('yellow',     'required for "ar" filter.'),
 286      'exif_thumbnail'        => array('yellow',     'required to extract EXIF thumbnails.'),
 287      'memory_get_usage'      => array('lightgreen', 'mostly used for troubleshooting.'),
 288      'version_compare'       => array('darkgreen',  'available in PHP v4.1.0+, internal workaround available'),
 289      'file_get_contents'     => array('darkgreen',  'available in PHP v4.3.0+, internal workaround available'),
 290      'file_put_contents'     => array('darkgreen',  'available in PHP v5.0.0+, internal workaround available'),
 291      'is_executable'         => array('yellow',     'available in PHP3, except only PHP5 for Windows. poor internal workaround available'),
 292      'gd_info'               => array('olive',      'available in PHP v4.3.0+ (with bundled GD2), internal workaround available'),
 293      'ImageTypes'            => array('red',        'required for GD image output.'),
 294      'ImageCreateFromJPEG'   => array('orange',     'required for JPEG source images using GD.'),
 295      'ImageCreateFromGIF'    => array('yellow',     'useful for GIF source images using GD.'),
 296      'ImageCreateFromPNG'    => array('orange',     'required for PNG source images using GD and other source image formats using ImageMagick.'),
 297      'ImageCreateFromWBMP'   => array('yellow',     'required for WBMP source images using GD.'),
 298      'ImageCreateFromString' => array('orange',     'required for HTTP and non-file image sources.'),
 299      'ImageCreateTrueColor'  => array('orange',     'required for all non-ImageMagick filters.'),
 300      'ImageIsTrueColor'      => array('olive',      'available in PHP v4.3.2+ && GD v2.0.1+'),
 301      'ImageFilter'           => array('yellow',     'PHP5 only. Required for some filters (but most can use ImageMagick instead)'),
 302  );
 303  foreach ($FunctionsExist as $function => $details) {
 304      list($color, $description) = $details;
 305      echo '<tr><th>'.$function.'</th><th colspan="2" bgcolor="';
 306      if (function_exists(strtolower($function))) {
 307          echo 'lime">TRUE';
 308      } else {
 309          echo $color.'">FALSE';
 310      }
 311      echo '</th><td>'.$description.'</td></tr>';
 312  }
 313  
 314  
 315  echo '<tr bgcolor="#EEEEEE"><th colspan="4">&nbsp;</th></tr>';
 316  echo '<tr bgcolor="#EEEEEE"><th>Setting</th><th>Master Value</th><th>Local Value</th><th>Comments</th></tr>';
 317  
 318  
 319  $SettingFeatures = array(
 320      'magic_quotes_runtime' => array('red',    'lime',   'This setting is evil. Turn it off.'),
 321      'magic_quotes_gpc'     => array('orange', 'lime',   'This setting is bad. Turn it off, if possible. phpThumb will attempt to work around it if it is enabled.'),
 322      'safe_mode'            => array('orange', 'lime',   'Best if off. Calls to ImageMagick will be disabled if on (limiting max image resolution, no animated GIF resize). Temp files may be disabled. Features will be limited.'),
 323      'allow_url_fopen'      => array('lime',   'yellow', 'Best if on. HTTP source images will be unavailable if disabled and CURL is unavailable.'),
 324      'magic_quotes_runtime' => array('red', 'lime', 'This setting is evil. Turn it off.'),
 325  );
 326  
 327  foreach ($SettingFeatures as $feature => $FeaturesDetails) {
 328      list($color_true, $color_false, $reason) = $FeaturesDetails;
 329      echo '<tr><th>'.$feature.':</th>';
 330      echo '<th bgcolor="'.(@get_cfg_var($feature) ? $color_true : $color_false).'">'.$phpThumb->phpThumbDebugVarDump((bool) @get_cfg_var($feature)).'</th>';
 331      echo '<th bgcolor="'.(@ini_get($feature)     ? $color_true : $color_false).'">'.$phpThumb->phpThumbDebugVarDump((bool) @ini_get($feature)).'</th>';
 332      echo '<td>'.$reason.'</td></tr>';
 333  }
 334  
 335  $MissingFunctionSeverity = array(
 336      'shell_exec' => 'red',
 337      'system'     => 'red',
 338      'passthru'   => 'red',
 339      'exec'       => 'red',
 340      'curl_exec'  => 'orange',
 341  );
 342  $DisabledFunctions[0] = explode(',', @get_cfg_var('disable_functions'));
 343  $DisabledFunctions[1] = explode(',',     @ini_get('disable_functions'));
 344  echo '<tr><th>disable_functions:</th>';
 345  for ($i = 0; $i <= 1; $i++) {
 346      echo '<th bgcolor="'.(count($DisabledFunctions[$i]) ? 'yellow' : 'lime').'">';
 347      $disabled_functions = '';
 348      foreach ($DisabledFunctions[$i] as $key => $value) {
 349          if (@$MissingFunctionSeverity[$value]) {
 350              $DisabledFunctions[$i][$key] = '<span style="background-color: '.$MissingFunctionSeverity[$value].';">'.$value.'</span>';
 351          }
 352      }
 353      echo implode(', ', $DisabledFunctions[$i]).'</th>';
 354  }
 355  echo '<td>Best if nothing disabled. Calls to ImageMagick will be prevented if exec+system+shell_exec+passthru are disabled.</td></tr>';
 356  
 357  
 358  echo '<tr><th>memory_limit:</th><th bgcolor="';
 359  $memory_limit = @get_cfg_var('memory_limit');
 360  if (!$memory_limit) {
 361      echo 'lime';
 362  } elseif ($memory_limit >= 32) {
 363      echo 'lime';
 364  } elseif ($memory_limit >= 24) {
 365      echo 'lightgreen';
 366  } elseif ($memory_limit >= 16) {
 367      echo 'green';
 368  } elseif ($memory_limit >= 12) {
 369      echo 'darkgreen';
 370  } elseif ($memory_limit >= 8) {
 371      echo 'olive';
 372  } elseif ($memory_limit >= 4) {
 373      echo 'yellow';
 374  } elseif ($memory_limit >= 2) {
 375      echo 'orange';
 376  } else {
 377      echo 'red';
 378  }
 379  echo '">'.($memory_limit ? $memory_limit : '<i>unlimited</i>').'</th><th bgcolor="';
 380  $memory_limit = @ini_get('memory_limit');
 381  if (!$memory_limit) {
 382      echo 'lime';
 383  } elseif ($memory_limit >= 32) {
 384      echo 'lime';
 385  } elseif ($memory_limit >= 24) {
 386      echo 'lightgreen';
 387  } elseif ($memory_limit >= 16) {
 388      echo 'green';
 389  } elseif ($memory_limit >= 12) {
 390      echo 'darkgreen';
 391  } elseif ($memory_limit >= 8) {
 392      echo 'olive';
 393  } elseif ($memory_limit >= 4) {
 394      echo 'yellow';
 395  } elseif ($memory_limit >= 2) {
 396      echo 'orange';
 397  } else {
 398      echo 'red';
 399  }
 400  echo '">'.($memory_limit ? $memory_limit : '<i>unlimited</i>').'</th>';
 401  echo '<td>The higher the better. Divide by 5 to get maximum megapixels of source image that can be thumbnailed (without ImageMagick).'.($memory_limit ? ' Your setting ('.$memory_limit.') allows images up to approximately '.number_format($memory_limit / 5, 1).' megapixels' : '').'</td></tr>';
 402  
 403  
 404  ?>
 405  </table>
 406  </body>
 407  </html>


Generated: Mon Dec 1 03:56:46 2008 Cross-referenced by PHPXref 0.7