本文整理汇总了PHP中cls_image::gd_version方法的典型用法代码示例。如果您正苦于以下问题:PHP cls_image::gd_version方法的具体用法?PHP cls_image::gd_version怎么用?PHP cls_image::gd_version使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类cls_image
的用法示例。
在下文中一共展示了cls_image::gd_version方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: strpos
/* 复制一份相册图片 */
/* 添加判断是否自动生成相册图片 */
if ($_CFG['auto_generate_gallery']) {
$img = $original_img;
// 相册图片
$pos = strpos(basename($img), '.');
$newname = dirname($img) . '/' . $image->random_filename() . substr(basename($img), $pos);
if (!copy('../' . $img, '../' . $newname)) {
sys_msg('fail to copy file: ' . realpath('../' . $img), 1, array(), false);
}
$img = $newname;
$gallery_img = $img;
$gallery_thumb = $img;
}
// 如果系统支持GD,缩放商品图片,且给商品图片和相册图片加水印
if ($proc_thumb && $image->gd_version() > 0 && $image->check_img_function($_FILES['goods_img']['type']) || $is_url_goods_img) {
if (empty($is_url_goods_img)) {
// 如果设置大小不为0,缩放图片
if ($_CFG['image_width'] != 0 || $_CFG['image_height'] != 0) {
$goods_img = $image->make_thumb('../' . $goods_img, $GLOBALS['_CFG']['image_width'], $GLOBALS['_CFG']['image_height']);
if ($goods_img === false) {
sys_msg($image->error_msg(), 1, array(), false);
}
}
/* 添加判断是否自动生成相册图片 */
if ($_CFG['auto_generate_gallery']) {
$newname = dirname($img) . '/' . $image->random_filename() . substr(basename($img), $pos);
if (!copy('../' . $img, '../' . $newname)) {
sys_msg('fail to copy file: ' . realpath('../' . $img), 1, array(), false);
}
$gallery_img = $newname;
示例2: strpos
}
$goods_img = $original_img;
// 商品图片
/* 复制一份相册图片 */
$img = $original_img;
// 相册图片
$pos = strpos(basename($img), '.');
$newname = dirname($img) . '/' . $image->random_filename() . substr(basename($img), $pos);
if (!copy('../' . $img, '../' . $newname)) {
sys_msg('fail to copy file: ' . realpath('../' . $img), 1, array(), false);
}
$img = $newname;
$gallery_img = $img;
$gallery_thumb = $img;
// 如果系统支持GD,缩放商品图片,且给商品图片和相册图片加水印
if ($image->gd_version() > 0 && $image->check_img_function($_FILES['goods_img']['type'])) {
// 如果设置大小不为0,缩放图片
if ($_CFG['image_width'] != 0 || $_CFG['image_height'] != 0) {
$goods_img = $image->make_thumb('../' . $goods_img, $GLOBALS['_CFG']['image_width'], $GLOBALS['_CFG']['image_height']);
if ($goods_img === false) {
sys_msg($image->error_msg(), 1, array(), false);
}
}
$newname = dirname($img) . '/' . $image->random_filename() . substr(basename($img), $pos);
if (!copy('../' . $img, '../' . $newname)) {
sys_msg('fail to copy file: ' . realpath('../' . $img), 1, array(), false);
}
$gallery_img = $newname;
// 加水印
if (intval($_CFG['watermark_place']) > 0 && !empty($GLOBALS['_CFG']['watermark'])) {
if ($image->add_watermark('../' . $goods_img, '', $GLOBALS['_CFG']['watermark'], $GLOBALS['_CFG']['watermark_place'], $GLOBALS['_CFG']['watermark_alpha']) === false) {
示例3: get_gd_version
/**
* 获得GD的版本号
*
* @access public
* @return string 返回版本号,可能的值为0,1,2
*/
function get_gd_version()
{
include_once ROOT_PATH . 'includes/cls_image.php';
$image = new cls_image();
return $image->gd_version();
}
示例4: gd_version
/**
* 获得服务器上的 GD 版本
*
* @access public
* @return int 可能的值为0,1,2
*/
function gd_version()
{
include_once(ROOT_PATH . 'includes/cls_image.php');
return cls_image::gd_version();
}
示例5: gd_version
/**
* 获得服务器上的 GD 版本
*
* @access public
* @return int 可能的值为0,1,2
*/
function gd_version()
{
include_once ROOT_PATH . 'czk/includes/cls_image.php';
return cls_image::gd_version();
}
示例6: gd_version_tianxin100
function gd_version_tianxin100()
{
include_once ROOT_PATH . 'include/cls_image_tianxin.php';
return cls_image::gd_version();
}
示例7: API_AddGoods
/**
* 添加商品
*
* @param array $post
*/
function API_AddGoods($post)
{
//debug_text();
global $_CFG;
/* 加载后台操作类与函数 */
require_once ROOT_PATH . ADMIN_PATH . '/includes/lib_main.php';
require_once ROOT_PATH . ADMIN_PATH . '/includes/lib_goods.php';
require_once ROOT_PATH . 'includes/cls_image.php';
/* 检查权限 */
admin_privilege('goods_manage');
$image = new cls_image($GLOBALS['_CFG']['bgcolor']);
$code = empty($_POST['extension_code']) ? '' : trim($_POST['extension_code']);
/* 插入还是更新的标识 */
$is_insert = $_POST['act'] == 'insert';
/* 如果是更新,先检查该商品是否存在,不存在,则退出。 */
if (!$is_insert) {
$sql = "SELECT COUNT(*) FROM " . $GLOBALS['ecs']->table('goods') . " WHERE goods_id = '{$_POST['goods_id']}' AND is_delete = 0";
if ($GLOBALS['db']->getOne($sql) <= 0) {
client_show_message(240);
//货号重复
}
}
/* 检查货号是否重复 */
if ($_POST['goods_sn']) {
$sql = "SELECT COUNT(*) FROM " . $GLOBALS['ecs']->table('goods') . " WHERE goods_sn = '{$_POST['goods_sn']}' AND is_delete = 0 AND goods_id <> '{$_POST['goods_id']}'";
if ($GLOBALS['db']->getOne($sql) > 0) {
client_show_message(200);
//货号重复
}
}
/* 处理商品图片 */
$goods_img = '';
// 初始化商品图片
$goods_thumb = '';
// 初始化商品缩略图
$original_img = '';
// 初始化原始图片
$old_original_img = '';
// 初始化原始图片旧图
$allow_file_type = array('jpg', 'jpeg', 'png', 'gif');
if (!empty($_POST['goods_img']['Data'])) {
if (!in_array($_POST['goods_img']['Type'], $allow_file_type)) {
client_show_message(201);
}
if (client_check_image_size($_POST['goods_img']['Data']) === false) {
client_show_message(202);
}
if ($_POST['goods_id'] > 0) {
/* 删除原来的图片文件 */
$sql = "SELECT goods_thumb, goods_img, original_img " . " FROM " . $GLOBALS['ecs']->table('goods') . " WHERE goods_id = '{$_POST['goods_id']}'";
$row = $GLOBALS['db']->getRow($sql);
if ($row['goods_thumb'] != '' && is_file(ROOT_PATH . '/' . $row['goods_thumb'])) {
@unlink(ROOT_PATH . '/' . $row['goods_thumb']);
}
if ($row['goods_img'] != '' && is_file(ROOT_PATH . '/' . $row['goods_img'])) {
@unlink(ROOT_PATH . '/' . $row['goods_img']);
}
if ($row['original_img'] != '' && is_file(ROOT_PATH . '/' . $row['original_img'])) {
/* 先不处理,以防止程序中途出错停止 */
//$old_original_img = $row['original_img']; //记录旧图路径
}
}
$original_img = upload_image($_POST['goods_img']);
// 原始图片
if ($original_img === false) {
client_show_message(210);
// 写入商品图片出错
}
$goods_img = $original_img;
// 商品图片
/* 复制一份相册图片 */
$img = $original_img;
// 相册图片
$pos = strpos(basename($img), '.');
$newname = dirname($img) . '/' . random_filename() . substr(basename($img), $pos);
if (!copy(ROOT_PATH . '/' . $img, ROOT_PATH . '/' . $newname)) {
client_show_message(211);
// 复制相册图片时出错
}
$img = $newname;
$gallery_img = $img;
$gallery_thumb = $img;
/* 图片属性 */
$img_property = $image->gd_version() > 0 ? getimagesize(ROOT_PATH . '/' . $goods_img) : array();
// 如果系统支持GD,缩放商品图片,且给商品图片和相册图片加水印
if ($image->gd_version() > 0 && $image->check_img_function($img_property[2])) {
// 如果设置大小不为0,缩放图片
if ($GLOBALS['_CFG']['image_width'] != 0 || $GLOBALS['_CFG']['image_height'] != 0) {
$goods_img = $image->make_thumb(ROOT_PATH . '/' . $goods_img, $GLOBALS['_CFG']['image_width'], $GLOBALS['_CFG']['image_height']);
if ($goods_img === false) {
client_show_message(212);
}
}
// 加水印
if (intval($GLOBALS['_CFG']['watermark_place']) > 0 && !empty($GLOBALS['_CFG']['watermark'])) {
//.........这里部分代码省略.........
示例8: empty
if (!empty($goods_where)) {
$album_where = ', ' . $ecs->table('goods') . " AS g WHERE album.img_original > '' AND album.goods_id = g.goods_id " . $goods_where;
} else {
$album_where = " WHERE album.img_original > ''";
}
/* 设置最长执行时间为5分钟 */
@set_time_limit(300);
if (isset($_GET['start'])) {
$page_size = 50;
// 默认50张/页
$thumb = empty($_GET['thumb']) ? 0 : 1;
$watermark = empty($_GET['watermark']) ? 0 : 1;
$change = empty($_GET['change']) ? 0 : 1;
$silent = empty($_GET['silent']) ? 0 : 1;
/* 检查GD */
if ($image->gd_version() < 1) {
make_json_error($_LANG['missing_gd']);
}
/* 如果需要添加水印,检查水印文件 */
if (!empty($_CFG['watermark']) && $_CFG['watermark_place'] > 0 && $watermark && !$image->validate_image($_CFG['watermark'])) {
make_json_error($image->error_msg());
}
$title = '';
if (isset($_GET['total_icon'])) {
$count = $db->GetOne("SELECT COUNT(*) FROM " . $ecs->table('goods') . " AS g WHERE g.original_img <> ''" . $goods_where);
$title = sprintf($_LANG['goods_format'], $count, $page_size);
}
if (isset($_GET['total_album'])) {
$count = $GLOBALS['db']->GetOne("SELECT COUNT(*) FROM " . $GLOBALS['ecs']->table('goods_gallery') . ' AS album ' . $album_where);
$title = sprintf(' ' . $_LANG['gallery_format'], $count, $page_size);
$module_no = 1;
示例9: gd_version
/**
* 获得服务器上的 GD 版本
*
* @access public
* @return int 可能的值为0,1,2
*/
function gd_version()
{
include_once(ROOT_PATH . 'includes/cls_image.php');
// return cls_image::gd_version();
$p = new cls_image();
return $p->gd_version();
}
示例10: get_gd_version
/**
* 获得GD的版本号
*
* @access public
* @return string 返回版本号,可能的值为0,1,2
*/
function get_gd_version()
{
include_once ROOT_PATH . 'tools/controllers/includes/cls_image.php';
return cls_image::gd_version();
}
示例11: gd_version
/**
* 获得服务器上的 GD 版本
*
* @access public
* @return int 可能的值为0,1,2
*/
function gd_version()
{
include_once(ROOT_PATH . 'includes/cls_image.php');
$im = new cls_image();
return $im->gd_version();
}