Improved GD 2 detection (bugs #736111, #741192).

This commit is contained in:
Michal Čihař
2003-05-22 12:21:53 +00:00
parent 1ccd69980a
commit 4bdb4b8deb
6 changed files with 92 additions and 6 deletions

View File

@@ -11,6 +11,9 @@ $Source$
* tbl_replace_fields.php3, libraries/build_dump.lib.php3,
libraries/display_tbl.lib.php3: Don't hexify BLOB if it is empty (bug
#741599).
* Documentation, config.inc.php3, libraries/config_import.lib.php3,
libraries/defines_php.lib.php3: Improved GD 2 detection (bugs #736111,
#741192).
2003-05-22 Garvin Hicking <me@supergarv.de>
* sql.php3, libraries/common.lib.php3: Bug #692854: Never execute

View File

@@ -1345,6 +1345,24 @@ $cfg['PmaAbsoluteUri'] = (!empty($_SERVER['HTTPS']) ? 'https' : 'http') . '://'
<br /><br />
</dd>
<dt><b>$cfg['GD2Available'] </b>string</dt>
<dd>
Specifies whether GD &gt;= 2 is available. If yes it can be used for
MIME transformations.<br />
Possible values are:<br />
<ul>
<li>
auto - automatically detect, this is a bit expensive
operation for php &lt; 4.3.0 so it is preffered to change this
according to your server real possibilities
</li>
<li>yes - GD 2 functions can be used</li>
<li>no - GD 2 function can not be used</li>
</ul>
Default is auto.
<br /><br />
</dd>
<dt><b>$cfg['LeftWidth'] </b>integer</dt>
<dd>
Left frame width in pixel.

View File

@@ -14,8 +14,8 @@
+ Version history: ChangeLog
+ General notes: README
+ License: LICENSE
* Documentation version: $Id: Documentation.html,v 1.442 2003/05/14
12:39:42 garvinhicking Exp $
* Documentation version: $Id: Documentation.html,v 1.445 2003/05/19
17:11:33 lem9 Exp $
Requirements
@@ -376,6 +376,8 @@ $cfg['PmaAbsoluteUri'] = (!empty($_SERVER['HTTPS']) ? 'https' : 'http') . '://'
privileges rules of the MySQL database server. If set, it just
means only these databases will be displayed but not at all
other databases can't be used.
An example of using more that one database:
$cfg['Servers'][$i]['only_db'] = array('db1', 'db2');
$cfg['Servers'][$i]['verbose'] string
Only useful when using phpMyAdmin with multiple server entries.
@@ -898,6 +900,19 @@ $cfg['PmaAbsoluteUri'] = (!empty($_SERVER['HTTPS']) ? 'https' : 'http') . '://'
here listed, so if you frequently use some of these move them
to the top.
$cfg['GD2Available'] string
Specifies whether GD >= 2 is available. If yes it can be used
for MIME transformations.
Possible values are:
+ auto - automatically detect, this is a bit expensive
operation for php < 4.3.0 so it is preffered to change this
according to your server real possibilities
+ yes - GD 2 functions can be used
+ no - GD 2 function can not be used
Default is auto.
$cfg['LeftWidth'] integer
Left frame width in pixel.
@@ -1066,7 +1081,7 @@ $cfg['PmaAbsoluteUri'] = (!empty($_SERVER['HTTPS']) ? 'https' : 'http') . '://'
$cfg['MaxExactCount'] integer
Determines for how large tables phpMyAdmin should get exact row
count by SELECT COUNT. If approximate row cound is smaller than
count by SELECT COUNT. If approximate row count is smaller than
this value, SELECT COUNT will be used, otherwise only value
returned by SHOW TABLE STATUS.

View File

@@ -446,6 +446,13 @@ $cfg['SaveDir'] = ''; // for example, './save/'; you must
// directory
/**
* Misc. settings
*/
$cfg['GD2Available'] = 'auto'; // Is GD >= 2 available? Set to yes/no/auto. 'auto'
// does autodetection, which is a bit expensive for
// php < 4.3.0, but it is the only safe vay how to
// determine GD version.
/**
* SQL Parser Settings
*/

View File

@@ -1063,6 +1063,9 @@ if (!defined('PMA_CONFIG_IMPORT_LIB_INCLUDED')) {
if (!isset($cfg['PmaNoRelation_DisableWarning'])) {
$cfg['PmaNoRelation_DisableWarning'] = FALSE;
}
if (!isset($cfg['GD2Available'])) {
$cfg['GD2Available'] = 'auto';
}
} // $__PMA_CONFIG_IMPORT_LIB__

View File

@@ -64,12 +64,52 @@ if (!defined('PMA_IS_WINDOWS')) {
// Whether GD2 is present
if (!defined('PMA_IS_GD2')) {
$testGD = @imagecreatetruecolor(12,12);
if ($testGD) {
if ($cfg['GD2Available'] == 'yes') {
define('PMA_IS_GD2', 1);
} elseif ($cfg['GD2Available'] == 'no') {
define('PMA_IS_GD2', 0);
} else {
if (((PMA_PHP_INT_VERSION >= 40000 && !@ini_get('safe_mode') && @ini_get('enable_dl'))
|| (PMA_PHP_INT_VERSION < 40000 && PMA_PHP_INT_VERSION > 30009 && !@get_cfg_var('safe_mode')))
&& @function_exists('dl')) {
if (PMA_IS_WINDOWS) {
$suffix = '.dll';
} else {
$suffix = '.so';
}
if (!@extension_loaded('gd')) {
@dl('gd' . $suffix);
}
}
if (!@function_exists('imagecreatetruecolor')) {
define('PMA_IS_GD2', 0);
} else {
if (@function_exists('gd_info')) {
$gd_nfo = gd_info();
if (strstr($gd_nfo["GD Version"], '2.')) {
define('PMA_IS_GD2', 1);
} else {
define('PMA_IS_GD2', 0);
}
} else {
/* We must do hard way... */
ob_start();
phpinfo(8); /* Only modules */
$a = ob_get_contents();
ob_end_clean();
/* Get GD version string from phpinfo output */
if (ereg('<tr><td[^>]*>[^>]*GD Version[^<]*</td><td[^>]*>\([^<]*\)</td></tr>', $a, $v)) {
if (strstr($v, '2.')) {
define('PMA_IS_GD2', 1);
} else {
define('PMA_IS_GD2', 0);
}
} else {
define('PMA_IS_GD2', 0);
}
}
}
}
}
// $__PMA_DEFINES_PHP_LIB__
?>