本文整理汇总了PHP中get_gd_version函数的典型用法代码示例。如果您正苦于以下问题:PHP get_gd_version函数的具体用法?PHP get_gd_version怎么用?PHP get_gd_version使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_gd_version函数的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: get_system_info
/**
* 获得系统的信息
*
* @access public
* @return array 系统各项信息组成的数组
*/
function get_system_info($_LANG = array())
{
$system_info = array();
/* 检查系统基本参数 */
$system_info[] = array($_LANG['php_os'], PHP_OS);
$system_info[] = array($_LANG['php_ver'], PHP_VERSION);
/* 检查MYSQL支持情况 */
$mysql_enabled = function_exists('mysql_connect') ? $_LANG['support'] : $_LANG['not_support'];
$system_info[] = array($_LANG['does_support_mysql'], $mysql_enabled);
/* 检查图片处理函数库 */
$gd_ver = get_gd_version();
$gd_ver = empty($gd_ver) ? $_LANG['not_support'] : $gd_ver;
if ($gd_ver > 0) {
if (PHP_VERSION >= '4.3' && function_exists('gd_info')) {
$gd_info = gd_info();
$jpeg_enabled = $gd_info['JPEG Support'] === true ? $_LANG['support'] : $_LANG['not_support'];
$gif_enabled = $gd_info['GIF Create Support'] === true ? $_LANG['support'] : $_LANG['not_support'];
$png_enabled = $gd_info['PNG Support'] === true ? $_LANG['support'] : $_LANG['not_support'];
} else {
if (function_exists('imagetypes')) {
$jpeg_enabled = (imagetypes() & IMG_JPG) > 0 ? $_LANG['support'] : $_LANG['not_support'];
$gif_enabled = (imagetypes() & IMG_GIF) > 0 ? $_LANG['support'] : $_LANG['not_support'];
$png_enabled = (imagetypes() & IMG_PNG) > 0 ? $_LANG['support'] : $_LANG['not_support'];
} else {
$jpeg_enabled = $_LANG['not_support'];
$gif_enabled = $_LANG['not_support'];
$png_enabled = $_LANG['not_support'];
}
}
} else {
$jpeg_enabled = $_LANG['not_support'];
$gif_enabled = $_LANG['not_support'];
$png_enabled = $_LANG['not_support'];
}
$system_info[] = array($_LANG['gd_version'], $gd_ver);
$system_info[] = array($_LANG['jpeg'], $jpeg_enabled);
$system_info[] = array($_LANG['gif'], $gif_enabled);
$system_info[] = array($_LANG['png'], $png_enabled);
/* 检查系统是否支持以dwt,lib,dat为扩展名的文件 */
// $file_types = array(
// 'dwt' => ROOT_PATH . 'themes/default/index.dwt',
// 'lbi' => ROOT_PATH . 'themes/default/library/member.lbi',
// 'dat' => ROOT_PATH . 'includes/codetable/ipdata.dat'
// );
// $exists_info = file_types_exists($file_types);
// $exists_info = empty($exists_info) ? $_LANG['support_dld'] : $exists_info;
// $system_info[] = array($_LANG['does_support_dld'], $exists_info);
/* 服务器是否安全模式开启 */
$safe_mode = ini_get('safe_mode') == '1' ? $_LANG['safe_mode_on'] : $_LANG['safe_mode_off'];
$system_info[] = array($_LANG['safe_mode'], $safe_mode);
return $system_info;
}
开发者ID:hobbysh,项目名称:seevia-opensource,代码行数:58,代码来源:lib_installer.php
示例2: wp_dashboard_serverinfo
function wp_dashboard_serverinfo()
{
global $text_direction;
if ('rtl' == $text_direction) {
echo '<style type="text/css"> #wp-serverinfo ul { padding-left: 15px !important; } </style>';
echo '<div id="wp-serverinfo" style="direction: ltr; text-align: left;">';
}
echo '<p><strong>' . __('General', 'wp-serverinfo') . '</strong></p>';
echo '<ul>';
echo '<li>' . __('OS', 'wp-serverinfo') . ': <strong>' . PHP_OS . '</strong></li>';
echo '<li>' . __('Server', 'wp-serverinfo') . ': <strong>' . $_SERVER["SERVER_SOFTWARE"] . '</strong></li>';
echo '<li>' . __('Hostname', 'wp-serverinfo') . ': <strong>' . $_SERVER['SERVER_NAME'] . '</strong></li>';
echo '<li>' . __('IP:Port', 'wp-serverinfo') . ': <strong>' . $_SERVER['SERVER_ADDR'] . ':' . $_SERVER['SERVER_PORT'] . '</strong></li>';
echo '<li>' . __('Document Root', 'wp-serverinfo') . ': <strong>' . $_SERVER['DOCUMENT_ROOT'] . '</strong></li>';
echo '</ul>';
echo '<p><strong>PHP</strong></p>';
echo '<ul>';
echo '<li>v<strong>' . PHP_VERSION . '</strong></li>';
echo '<li>GD: <strong>' . get_gd_version() . '</strong></li>';
echo '<li>' . __('Magic Quotes GPC', 'wp-serverinfo') . ': <strong>' . get_php_magic_quotes_gpc() . '</strong></li>';
echo '<li>' . __('Memory Limit', 'wp-serverinfo') . ': <strong>' . format_php_size(get_php_memory_limit()) . '</strong></li>';
echo '<li>' . __('Max Upload Size', 'wp-serverinfo') . ': <strong>' . format_php_size(get_php_upload_max()) . '</strong></li>';
echo '</ul>';
echo '<p><strong>MYSQL</strong></p>';
echo '<ul>';
echo '<li>v<strong>' . get_mysql_version() . '</strong></li>';
echo '<li>' . __('Maximum No. Connections', 'wp-serverinfo') . ': <strong>' . number_format_i18n(get_mysql_max_allowed_connections(), 0) . '</strong></li>';
echo '<li>' . __('Maximum Packet Size', 'wp-serverinfo') . ': <strong>' . format_filesize(get_mysql_max_allowed_packet()) . '</strong></li>';
echo '<li>' . __('Data Disk Usage', 'wp-serverinfo') . ': <strong>' . format_filesize(get_mysql_data_usage()) . '</strong></li>';
echo '<li>' . __('Index Disk Usage', 'wp-serverinfo') . ': <strong>' . format_filesize(get_mysql_index_usage()) . '</strong></li>';
echo '</ul>';
echo '<p class="textright"><a href="' . admin_url('index.php?page=wp-serverinfo/wp-serverinfo.php') . '" class="button">' . __('View all', 'wp-serverinfo') . '</a></p>';
if ('rtl' == $text_direction) {
echo '</div>';
}
}
开发者ID:alexanderpetrob89,项目名称:fei.edu,代码行数:36,代码来源:wp-serverinfo.php
示例3: gpc_get_string
$f_captcha = gpc_get_string('captcha', '');
$f_username = trim($f_username);
$f_email = email_append_domain(trim($f_email));
$f_captcha = utf8_strtolower(trim($f_captcha));
# Retrieve captcha key now, as session might get cleared by logout
$t_form_key = session_get_int(CAPTCHA_KEY, null);
# force logout on the current user if already authenticated
if (auth_is_user_authenticated()) {
auth_logout();
}
# Check to see if signup is allowed
if (OFF == config_get_global('allow_signup')) {
print_header_redirect('login_page.php');
exit;
}
if (ON == config_get('signup_use_captcha') && get_gd_version() > 0 && helper_call_custom_function('auth_can_change_password', array())) {
# captcha image requires GD library and related option to ON
$t_key = utf8_strtolower(utf8_substr(md5(config_get('password_confirm_hash_magic_string') . $t_form_key), 1, 5));
if ($t_key != $f_captcha) {
trigger_error(ERROR_SIGNUP_NOT_MATCHING_CAPTCHA, ERROR);
}
# Clear captcha cache
session_delete(CAPTCHA_IMG);
}
email_ensure_not_disposable($f_email);
# notify the selected group a new user has signed-up
if (user_signup($f_username, $f_email)) {
email_notify_new_account($f_username, $f_email);
}
form_security_purge('signup');
html_page_top1();
开发者ID:Tarendai,项目名称:spring-website,代码行数:31,代码来源:signup.php
示例4: masc_captcha
function masc_captcha($config)
{
// Test for GD-Library(-Version)
$this->gd_version = get_gd_version();
if ($this->gd_version == 0) {
die("There is no GD-Library-Support enabled. The Captcha-Class cannot be used!");
}
if ($this->debug) {
echo "\n<br />-Captcha-Debug: The available GD-Library has major version " . $this->gd_version;
}
// extracts config array
if (is_array($config)) {
if ($this->debug) {
echo "\n<br />-Captcha-Debug: Extracts Config-Array in unsecure-mode!";
}
foreach ($config as $k => $v) {
$this->{$k} = $v;
}
}
// check vars for maxtry, secretposition and min-max-size
if ($this->minsize > $this->maxsize) {
$temp = $this->minsize;
$this->minsize = $this->maxsize;
$this->maxsize = $temp;
if ($this->debug) {
echo "<br />-Captcha-Debug: Arrghh! What do you think I mean with min and max? Switch minsize with maxsize.";
}
}
// check TrueTypeFonts
if (is_array($this->TTF_RANGE)) {
if ($this->debug) {
echo "\n<br />-Captcha-Debug: Check given TrueType-Array! (" . count($this->TTF_RANGE) . ")";
}
$temp = array();
foreach ($this->TTF_RANGE as $k => $v) {
if (is_readable($this->TTF_folder . $v)) {
$temp[] = $v;
}
}
$this->TTF_RANGE = $temp;
if ($this->debug) {
echo "\n<br />-Captcha-Debug: Valid TrueType-files: (" . count($this->TTF_RANGE) . ")";
}
//if(count($this->TTF_RANGE) < 1) die('No Truetypefont available for the CaptchaClass.');
} else {
if ($this->debug) {
echo "\n<br />-Captcha-Debug: Check given TrueType-File! (" . $this->TTF_RANGE . ")";
}
if (!is_readable($this->TTF_folder . $this->TTF_RANGE)) {
die('No Truetypefont available for the CaptchaClass.');
}
}
// select first TrueTypeFont
$this->change_TTF();
if ($this->debug) {
echo "\n<br />-Captcha-Debug: Set current TrueType-File: (" . $this->TTF_file . ")";
}
// get number of noise-chars for background if is enabled
$this->nb_noise = $this->noise ? $this->chars * $this->noisefactor : 0;
if ($this->debug) {
echo "\n<br />-Captcha-Debug: Set number of noise characters to: (" . $this->nb_noise . ")";
}
// set dimension of image
$this->lx = ($this->chars + 1) * (int) (($this->maxsize + $this->minsize) / 1.5);
$this->ly = (int) (2.4 * $this->maxsize);
if ($this->debug) {
echo "\n<br />-Captcha-Debug: Set image dimension to: (" . $this->lx . " x " . $this->ly . ")";
}
}
开发者ID:kaos,项目名称:mantisbt,代码行数:69,代码来源:make_captcha_img.php
示例5: print_test_row
print_test_row('check mail configuration: allow_signup = ON requires enable_email_notification = ON', OFF == config_get_global('allow_signup') || ON == config_get_global('enable_email_notification'));
print_test_row('check mail configuration: allow_signup = ON requires send_reset_password = ON', OFF == config_get_global('allow_signup') || ON == config_get_global('send_reset_password'));
print_test_row('check language configuration: fallback_language is not \'auto\'', 'auto' != config_get_global('fallback_language'));
print_test_row('check configuration: allow_anonymous_login = ON requires anonymous_account to be set', OFF == config_get_global('allow_anonymous_login') || strlen(config_get_global('anonymous_account')) > 0);
$t_anon_user = false;
print_test_row('check configuration: anonymous_account is a valid username if set', strlen(config_get_global('anonymous_account')) > 0 ? ($t_anon_user = user_get_id_by_name(config_get_global('anonymous_account'))) !== false : TRUE);
print_test_row('check configuration: anonymous_account should not be an administrator', $t_anon_user ? !user_is_administrator($t_anon_user) : TRUE);
print_test_row('$g_bug_link_tag is not empty ("' . config_get_global('bug_link_tag') . '")', '' != config_get_global('bug_link_tag'));
print_test_row('$g_bugnote_link_tag is not empty ("' . config_get_global('bugnote_link_tag') . '")', '' != config_get_global('bugnote_link_tag'));
print_test_row('filters: dhtml_filters = ON requires use_javascript = ON', OFF == config_get_global('dhtml_filters') || ON == config_get_global('use_javascript'));
print_test_row('Phpmailer sendmail configuration requires escapeshellcmd. Please use a different phpmailer method if this is blocked.', PHPMAILER_METHOD_SENDMAIL != config_get('phpMailer_method') || PHPMAILER_METHOD_SENDMAIL == config_get('phpMailer_method') && function_exists('escapeshellcmd'));
print_test_row('Phpmailer sendmail configuration requires escapeshellarg. Please use a different phpmailer method if this is blocked.', PHPMAILER_METHOD_SENDMAIL != config_get('phpMailer_method') || PHPMAILER_METHOD_SENDMAIL == config_get('phpMailer_method') && function_exists('escapeshellarg'));
check_zend_optimiser_version();
if (plugin_is_installed('MantisGraph')) {
plugin_push_current('MantisGraph');
print_test_row('checking gd is enabled, and version 2...', get_gd_version() == 2);
if (plugin_config_get('eczlibrary', ON) == OFF) {
$t_jpgraph_path = config_get('absolute_path') . 'library' . DIRECTORY_SEPARATOR . 'jpgraph' . DIRECTORY_SEPARATOR;
if (!file_exists($t_jpgraph_path . 'jpgraph.php')) {
print_test_row('checking we can find jpgraph class files...', false);
} else {
require_once $t_jpgraph_path . 'jpgraph.php';
print_test_row('Checking Jpgraph version (if installed)...', version_compare(JPG_VERSION, '2.3.0') ? true : false, JPG_VERSION);
}
print_test_row('check configuration: jpgraph (if used) requires php bundled gd for antialiasing support', plugin_config_get('jpgraph_antialias', OFF) == OFF || function_exists('imageantialias'));
}
plugin_pop_current();
}
print_test_row('Checking if ctype is enabled in php (required for rss feeds)....', extension_loaded('ctype'));
print_test_row('Checking for mysql is at least version 4.1...', !(db_is_mysql() && version_compare($t_serverinfo['version'], '4.1.0', '<')));
print_test_row('Checking for broken mysql version ( bug 10250)...', !(db_is_mysql() && $t_serverinfo['version'] == '4.1.21'));
开发者ID:nourchene-benslimane,项目名称:mantisV0,代码行数:31,代码来源:check.php
示例6: require_api
*
* @uses check_api.php
* @uses config_api.php
*/
if (!defined('CHECK_DISPLAY_INC_ALLOW')) {
return;
}
# MantisBT Check API
require_once 'check_api.php';
require_api('config_api.php');
check_print_section_header_row('Display');
check_print_test_row('bug_link_tag is not blank/null', config_get_global('bug_link_tag'), array(false => 'The value of the bug_link_tag option cannot be blank/null.'));
check_print_test_row('bugnote_link_tag is not blank/null', config_get_global('bugnote_link_tag'), array(false => 'The value of the bugnote_link_tag option cannot be blank/null.'));
if (plugin_is_installed('MantisGraph')) {
plugin_push_current('MantisGraph');
check_print_test_row('Checking GD library is enabled, and version 2...', get_gd_version() == 2);
if (plugin_config_get('eczlibrary', ON) == OFF) {
$t_jpgraph_path = plugin_config_get('jpgraph_path');
if ($t_jpgraph_path == '') {
$t_jpgraph_path = config_get('absolute_path') . 'library/jpgraph';
}
$t_jpgraph_path .= '/jpgraph.php';
$t_jpgraph_found = check_print_test_row('Checking we can find jpgraph library class files', file_exists($t_jpgraph_path), dirname($t_jpgraph_path));
if ($t_jpgraph_found) {
require_once $t_jpgraph_path;
# Old versions of jpgraph did not define the constant
$t_jpgraph_version = defined('JPG_VERSION') ? JPG_VERSION : 'Unknown version';
check_print_test_row('Checking jpgraph library version is at least 2.3.0', version_compare($t_jpgraph_version, '2.3.0', '>='), $t_jpgraph_version);
}
$t_jpgraph_antialias = plugin_config_get('jpgraph_antialias', OFF);
if ($t_jpgraph_antialias) {
开发者ID:gtn,项目名称:mantisbt,代码行数:31,代码来源:check_display_inc.php
示例7: lang_get
</div>
<div class="field-container">
<label for="email-field"><span><?php
echo lang_get('email_label');
?>
</span></label>
<span class="input"><?php
print_email_input('email', '');
?>
</span>
<span class="label-style"></span>
</div>
<?php
$t_allow_passwd = helper_call_custom_function('auth_can_change_password', array());
if (ON == config_get('signup_use_captcha') && get_gd_version() > 0 && true == $t_allow_passwd) {
# captcha image requires GD library and related option to ON
echo '<div class="field-container">';
echo '<label for="captcha-field"><span>' . lang_get('signup_captcha_request_label') . '</span></label>';
echo '<span id="captcha-input" class="input">';
print_captcha_input('captcha', '');
echo '<span class="captcha-image"><img src="make_captcha_img.php?public_key=' . $t_public_key . '" alt="visual captcha" /></span>';
echo '</span>';
echo '<input type="hidden" name="public_key" value="' . $t_public_key . '" />';
echo '<span class="label-style"></span>';
echo '</div>';
}
if (false == $t_allow_passwd) {
echo '<span id="no-password-msg">';
echo lang_get('no_password_request');
echo '</span>';
开发者ID:Kirill,项目名称:mantisbt,代码行数:31,代码来源:signup_page.php
示例8: convert_image
//.........这里部分代码省略.........
// Destroy the temporary image
imagedestroy($temp_img);
}
// Now we need to work out how much padding we're giving, and where
// The axis
if (intval(round(floatval($sx) / $thumb_options['scale'])) != $width) {
$pad_axis = 'x';
} else {
$pad_axis = 'y';
}
// The amount
if ($pad_axis == 'x') {
$padding = intval(round(floatval($width) - floatval($sx) / $thumb_options['scale']));
} else {
$padding = intval(round(floatval($height) - floatval($sy) / $thumb_options['scale']));
}
// The distribution
if ($thumb_options['where'] == 'start' || $thumb_options['where'] == 'start_if_vertical' && $pad_axis == 'y' || $thumb_options['where'] == 'start_if_horizontal' && $pad_axis == 'x') {
$pad_amount = 0;
} else {
$pad_amount = intval(floatval($padding) / 2.0);
}
// Now set all of the parameters needed for blitting our image
// $sx and $sy are fine, since they cover the whole image
$source_x = 0;
$source_y = 0;
$_width = $pad_axis == 'x' ? intval(round(floatval($sx) / $thumb_options['scale'])) : $width;
$_height = $pad_axis == 'y' ? intval(round(floatval($sy) / $thumb_options['scale'])) : $height;
$dest_x = $pad_axis == 'x' ? $pad_amount : 0;
$dest_y = $pad_axis == 'y' ? $pad_amount : 0;
}
}
// Resample/copy
$gd_version = get_gd_version();
if ($gd_version >= 2.0) {
// Set the background if we have one
if (!is_null($thumb_options) && !is_null($red)) {
$dest = imagecreatetruecolor($width, $height);
imagealphablending($dest, false);
if (function_exists('imagecolorallocatealpha') && $using_alpha) {
$back_col = imagecolorallocatealpha($dest, $red, $green, $blue, 127 - intval(floatval($alpha) / 2.0));
} else {
$back_col = imagecolorallocate($dest, $red, $green, $blue);
}
imagefilledrectangle($dest, 0, 0, $width, $height, $back_col);
if (function_exists('imagesavealpha')) {
imagesavealpha($dest, true);
}
} else {
$dest = imagecreatetruecolor($_width, $_height);
imagealphablending($dest, false);
if (function_exists('imagesavealpha')) {
imagesavealpha($dest, true);
}
}
imagecopyresampled($dest, $source, $dest_x, $dest_y, $source_x, $source_y, $_width, $_height, $sx, $sy);
} else {
// Set the background if we have one
if (!is_null($thumb_options) && !is_null($red)) {
$dest = imagecreate($width, $height);
$back_col = imagecolorallocate($dest, $red, $green, $blue);
imagefill($dest, 0, 0, $back_col);
} else {
$dest = imagecreate($_width, $_height);
}
imagecopyresized($dest, $source, $dest_x, $dest_y, $source_x, $source_y, $_width, $_height, $sx, $sy);
开发者ID:erico-deh,项目名称:ocPortal,代码行数:67,代码来源:images.php
示例9: lang_get
<div class="field-container">
<label for="email-field"><span><?php
echo lang_get('email_label');
?>
</span></label>
<span class="input"><?php
print_email_input('email', '');
?>
</span>
<span class="label-style"></span>
</div>
<?php
$t_allow_passwd_change = helper_call_custom_function('auth_can_change_password', array());
# captcha image requires GD library and related option to ON
if (ON == config_get('signup_use_captcha') && get_gd_version() > 0 && $t_allow_passwd_change) {
$t_securimage_path = 'library/securimage';
$t_securimage_show = $t_securimage_path . '/securimage_show.php';
$t_securimage_play = $t_securimage_path . '/securimage_play.swf?' . http_build_query(array('audio_file' => $t_securimage_path . '/securimage_play.php', 'bgColor1=' => '#fff', 'bgColor2=' => '#fff', 'iconColor=' => '#777', 'borderWidth=' => 1, 'borderColor=' => '#000'));
?>
<div class="field-container">
<label for="captcha-field">
<span><?php
echo lang_get('signup_captcha_request_label');
?>
</span>
</label>
<span id="captcha-input" class="input">
<?php
print_captcha_input('captcha');
?>
开发者ID:spring,项目名称:spring-website,代码行数:31,代码来源:signup_page.php
示例10: elseif
if ($maj == 5 && $min >= 3) {
return true;
} elseif ($maj > 5) {
return true;
} else {
return false;
}
}
if (isset($_POST['calibre_dir'])) {
$calibre_dir = $_POST['calibre_dir'];
$cd = check_calibre($calibre_dir);
} else {
$calibre_dir = null;
$cd = null;
}
$srv = $_SERVER['SERVER_SOFTWARE'];
$is_a = is_apache($srv);
if ($is_a) {
$mre = mod_rewrite_enabled();
} else {
$mre = false;
}
$gdv = get_gd_version();
if ($gdv >= 2) {
$gde = true;
} else {
$gde = false;
}
$template = $twig->loadTemplate('installcheck.html');
echo $template->render(array('page' => array('rot' => '', 'version' => '1.3.3'), 'is_a' => $is_a, 'srv' => $srv, 'mre' => $mre, 'calibre_dir' => $calibre_dir, 'cd' => $cd, 'htaccess' => file_exists('./.htaccess'), 'hsql' => has_sqlite(), 'hgd2' => $gde, 'hgd2v' => $gdv, 'dwrit' => fw('./data'), 'intl' => extension_loaded('intl'), 'mcrypt' => extension_loaded('mcrypt'), 'mwrit' => fw('./data/data.db'), 'opd' => ini_get('open_basedir'), 'php' => check_php(), 'phpv' => phpversion()));
#echo phpinfo();
开发者ID:Htut,项目名称:BicBucStriim,代码行数:31,代码来源:installcheck.php
示例11: liberty_gd_resize_image
/**
* liberty_gd_resize_image
*
* @param array $pFileHash
* @access public
* @return TRUE on success, FALSE on failure - mErrors will contain reason for failure
*/
function liberty_gd_resize_image(&$pFileHash)
{
global $gBitSystem;
$ret = NULL;
list($iwidth, $iheight, $itype, $iattr) = @getimagesize($pFileHash['source_file']);
list($type, $ext) = explode('/', strtolower($pFileHash['type']));
if (empty($pFileHash['max_width']) || empty($pFileHash['max_height']) || $iwidth <= $pFileHash['max_width'] && $iheight <= $pFileHash['max_height'] && ($ext == 'gif' || $ext == 'png' || $ext == 'jpg' || $ext == 'jpeg')) {
// Keep the same dimensions as input file
$pFileHash['max_width'] = $iwidth;
$pFileHash['max_height'] = $iheight;
} elseif ($iheight && $iwidth / $iheight > 0 && !empty($pFileHash['max_width']) && !empty($pFileHash['max_height'])) {
// we have a portrait image, flip everything
$temp = $pFileHash['max_width'];
$pFileHash['max_height'] = $pFileHash['max_width'];
$pFileHash['max_width'] = $temp;
}
// we need to scale and/or reformat
$fp = fopen($pFileHash['source_file'], "rb");
$data = fread($fp, filesize($pFileHash['source_file']));
fclose($fp);
if (function_exists("ImageCreateFromString")) {
$img = @imagecreatefromstring($data);
}
if (!empty($img)) {
$size_x = imagesx($img);
$size_y = imagesy($img);
}
if (!empty($img) && $size_x && $size_y) {
if ($size_x > $size_y && !empty($pFileHash['max_width'])) {
$tscale = (int) $size_x / $pFileHash['max_width'];
} elseif (!empty($pFileHash['max_height'])) {
$tscale = (int) $size_y / $pFileHash['max_height'];
} else {
$tscale = 1;
}
$tw = (int) ($size_x / $tscale);
$ty = (int) ($size_y / $tscale);
if (get_gd_version() > 1) {
$t = imagecreatetruecolor($tw, $ty);
imagesavealpha($t, TRUE);
imagealphablending($t, FALSE);
imagecopyresampled($t, $img, 0, 0, 0, 0, $tw, $ty, $size_x, $size_y);
} else {
$t = imagecreate($tw, $ty);
//$imagegallib->ImageCopyResampleBicubic($t, $img, 0, 0, 0, 0, $tw, $ty, $size_x, $size_y);
}
// override $mimeExt if we have a custom setting for it
if ($gBitSystem->isFeatureActive('liberty_thumbnail_format')) {
$mimeExt = $gBitSystem->getConfig('liberty_thumbnail_format');
} else {
// make sure we have image_type_to_extension available
include_once UTIL_PKG_PATH . 'PHP_Compat/Compat/Function/image_type_to_mime_type.php';
list($type, $mimeExt) = explode('/', strtolower(image_type_to_mime_type($itype)));
}
if ($mimeExt = preg_replace("!^(x-)?(jpeg|png|gif)\$!", "\$2", $mimeExt)) {
$targetType = $mimeExt;
$destExt = '.' . $mimeExt;
}
if (!$mimeExt || $mimeExt == 'jpeg') {
$targetType = 'jpeg';
$destExt = '.jpg';
}
if (!empty($pFileHash['dest_file'])) {
$destFile = $pFileHash['dest_file'];
} else {
$destFile = STORAGE_PKG_PATH . $pFileHash['dest_branch'] . $pFileHash['dest_base_name'] . $destExt;
}
switch ($targetType) {
case 'png':
if (imagetypes() & IMG_PNG) {
// png alpha stuff - needs more testing - spider
// imagecolorallocatealpha ( $t, 0, 0, 0, 127 );
// $ImgWhite = imagecolorallocate($t, 255, 255, 255);
// imagefill($t, 0, 0, $ImgWhite);
// imagecolortransparent($t, $ImgWhite);
imagepng($t, $destFile);
break;
}
case 'gif':
// This must go immediately before default so default will be hit for PHP's without gif support
if (imagetypes() & IMG_GIF) {
imagecolortransparent($t);
imagegif($t, $destFile);
break;
}
default:
imagejpeg($t, $destFile);
break;
}
// set permissions if possible - necessary for some wonky shared hosting environments
if (chmod($pFileHash['source_file'], 0644)) {
// does nothing, but fails elegantly
}
//.........这里部分代码省略.........
开发者ID:kailIII,项目名称:liberty,代码行数:101,代码来源:processor.gd.php
示例12: get_system_info
function get_system_info()
{
global $_LANG;
$system_info = array();
/* 检查系统基本参数 */
$system_info[] = array($_LANG['php_os'], PHP_OS);
$system_info[] = array($_LANG['php_ver'], PHP_VERSION);
/* 检查MYSQL支持情况 */
$mysql_enabled = function_exists('mysql_connect') ? $_LANG['support'] : $_LANG['not_support'];
$system_info[] = array($_LANG['does_support_mysql'], $mysql_enabled);
/* 检查图片处理函数库 */
$gd_ver = get_gd_version();
$gd_ver = empty($gd_ver) ? $_LANG['not_support'] : $gd_ver;
if ($gd_ver > 0) {
if (PHP_VERSION >= '4.3' && function_exists('gd_info')) {
$gd_info = gd_info();
$jpeg_enabled = $gd_info['JPG Support'] === true ? $_LANG['support'] : $_LANG['not_support'];
$gif_enabled = $gd_info['GIF Create Support'] === true ? $_LANG['support'] : $_LANG['not_support'];
$png_enabled = $gd_info['PNG Support'] === true ? $_LANG['support'] : $_LANG['not_support'];
} else {
if (function_exists('imagetypes')) {
$jpeg_enabled = (imagetypes() & IMG_JPG) > 0 ? $_LANG['support'] : $_LANG['not_support'];
$gif_enabled = (imagetypes() & IMG_GIF) > 0 ? $_LANG['support'] : $_LANG['not_support'];
$png_enabled = (imagetypes() & IMG_PNG) > 0 ? $_LANG['support'] : $_LANG['not_support'];
} else {
$jpeg_enabled = $_LANG['not_support'];
$gif_enabled = $_LANG['not_support'];
$png_enabled = $_LANG['not_support'];
}
}
} else {
$jpeg_enabled = $_LANG['not_support'];
$gif_enabled = $_LANG['not_support'];
$png_enabled = $_LANG['not_support'];
}
$system_info[] = array($_LANG['gd_version'], $gd_ver);
$system_info[] = array($_LANG['jpeg'], $jpeg_enabled);
$system_info[] = array($_LANG['gif'], $gif_enabled);
$system_info[] = array($_LANG['png'], $png_enabled);
/* 服务器是否安全模式开启 */
$safe_mode = ini_get('safe_mode') == '1' ? $_LANG['safe_mode_on'] : $_LANG['safe_mode_off'];
$system_info[] = array($_LANG['safe_mode'], $safe_mode);
return $system_info;
}
开发者ID:BGCX261,项目名称:zlskytakeorder-svn-to-git,代码行数:44,代码来源:ins_lib.php
示例13: trim
$f_username = trim( $f_username );
$f_email = email_append_domain( trim( $f_email ) );
$f_captcha = utf8_strtolower( trim( $f_captcha ) );
# force logout on the current user if already authenticated
if( auth_is_user_authenticated() ) {
auth_logout();
}
# Check to see if signup is allowed
if ( OFF == config_get_global( 'allow_signup' ) ) {
print_header_redirect( 'login_page.php' );
exit;
}
if( ON == config_get( 'signup_use_captcha' ) && get_gd_version() > 0 &&
helper_call_custom_function( 'auth_can_change_password', array() ) ) {
# captcha image requires GD library and related option to ON
$t_private_key = substr( hash( 'whirlpool', 'captcha' . config_get_global( 'crypto_master_salt' ) . $f_public_key, false ), 0, 5 );
if ( $t_private_key != $f_captcha ) {
trigger_error( ERROR_SIGNUP_NOT_MATCHING_CAPTCHA, ERROR );
}
}
email_ensure_not_disposable( $f_email );
# notify the selected group a new user has signed-up
if( user_signup( $f_username, $f_email ) ) {
email_notify_new_account( $f_username, $f_email );
}
开发者ID:rombert,项目名称:mantisbt,代码行数:31,代码来源:signup.php
注:本文中的get_gd_version函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论