本文整理汇总了PHP中cls_image::check_img_type方法的典型用法代码示例。如果您正苦于以下问题:PHP cls_image::check_img_type方法的具体用法?PHP cls_image::check_img_type怎么用?PHP cls_image::check_img_type使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类cls_image
的用法示例。
在下文中一共展示了cls_image::check_img_type方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: MAX
$cat_id = $db->insert_Id();
//货号
require_once ROOT_PATH . 'admin/includes/lib_goods.php';
$max_id = $db->getOne("SELECT MAX(goods_id) + 1 FROM " . $ecs->table('goods'));
$goods_sn = generate_goods_sn($max_id);
include_once ROOT_PATH . 'includes/cls_image.php';
$image = new cls_image($_CFG['bgcolor']);
if (!empty($good_name)) {
/* 检查图片:如果有错误,检查尺寸是否超过最大值;否则,检查文件类型 */
if (isset($_FILES['goods_img']['error'])) {
// 最大上传文件大小
$php_maxsize = ini_get('upload_max_filesize');
$htm_maxsize = '2M';
// 商品图片
if ($_FILES['goods_img']['error'] == 0) {
if (!$image->check_img_type($_FILES['goods_img']['type'])) {
sys_msg($_LANG['invalid_goods_img'], 1, array(), false);
}
} elseif ($_FILES['goods_img']['error'] == 1) {
sys_msg(sprintf($_LANG['goods_img_too_big'], $php_maxsize), 1, array(), false);
} elseif ($_FILES['goods_img']['error'] == 2) {
sys_msg(sprintf($_LANG['goods_img_too_big'], $htm_maxsize), 1, array(), false);
}
} else {
// 商品图片
if ($_FILES['goods_img']['tmp_name'] != 'none') {
if (!$image->check_img_type($_FILES['goods_img']['type'])) {
sys_msg($_LANG['invalid_goods_img'], 1, array(), false);
}
}
}
示例2: elseif
} elseif ($_REQUEST['act'] == 'finish') {
/* 检查权限 */
admin_priv('supplier_rebate');
/* 提交值 */
$rebate_id = intval($_POST['id']);
$remark = isset($_POST['remark']) ? addslashes($_POST['remark']) : '';
if (($rebates = rebateHave($rebate_id)) === false) {
sys_msg('该返佣记录不存在!');
}
include_once ROOT_PATH . '/includes/cls_image.php';
$image = new cls_image($_CFG['bgcolor']);
if ($_FILES['rebate_img']['size'] <= 0) {
sys_msg('汇票凭证必须上传!');
}
if ($_FILES['rebate_img']['error'] == 0) {
if (!$image->check_img_type($_FILES['rebate_img']['type'])) {
sys_msg($_LANG['invalid_goods_thumb'], 1, array(), false);
}
}
$dir = 'rebate/' . local_date("Ymd", gmtime()) . '/' . $rebates['supplier_id'];
$rebate_img = $image->upload_image($_FILES['rebate_img'], $dir);
$rebate = array('is_pay_ok' => 1, 'pay_time' => gmtime(), 'rebate_img' => $rebate_img, 'status' => 4);
/* 保存返佣信息 */
$db->autoExecute($ecs->table('supplier_rebate'), $rebate, 'UPDATE', "rebate_id = '" . $rebate_id . "'");
$loginfo = array('rebateid' => $rebate_id, 'addtime' => $addtime, 'reason' => '佣金' . createSign($rebates['rebate_id'], $rebates['supplier_id']) . '转帐:' . $rebates['payable_price'], 'supplier_money' => $rebates['payable_price'], 'doman' => '平台方:' . $_SESSION['user_name'], 'supplier_id' => $rebates['supplier_id']);
$db->autoExecute($ecs->table('supplier_money_log'), $loginfo, 'INSERT');
$db->query('update ' . $ecs->table('supplier') . " set supplier_money = supplier_money + " . $rebates['payable_price'] . " where supplier_id=" . $rebates['supplier_id']);
//修改佣金信息状态记录
$rebate_list = array('rebateid' => $rebate_id, 'username' => '平台方:' . $_SESSION['user_name'], 'type' => REBATE_LOG_LIST, 'typedec' => '平台方付款', 'contents' => '佣金状态由等待付款变结算完成', 'addtime' => gmtime());
$db->autoExecute($ecs->table('supplier_rebate_log'), $rebate_list, 'INSERT');
/* 清除缓存 */
示例3: COUNT
}
/* 检查货号是否重复 */
if ($_POST['goods_sn']) {
$sql = "SELECT COUNT(*) FROM " . $ecs->table('goods') . " WHERE goods_sn = '{$_POST['goods_sn']}' AND is_delete = 0 AND goods_id <> '{$_POST['goods_id']}'";
if ($db->getOne($sql) > 0) {
sys_msg($_LANG['goods_sn_exists'], 1, array(), false);
}
}
/* 检查图片:如果有错误,检查尺寸是否超过最大值;否则,检查文件类型 */
if (isset($_FILES['goods_img']['error'])) {
// 最大上传文件大小
$php_maxsize = ini_get('upload_max_filesize');
$htm_maxsize = '2M';
// 商品图片
if ($_FILES['goods_img']['error'] == 0) {
if (!$image->check_img_type($_FILES['goods_img']['type'])) {
sys_msg($_LANG['invalid_goods_img'], 1, array(), false);
}
} elseif ($_FILES['goods_img']['error'] == 1) {
sys_msg(sprintf($_LANG['goods_img_too_big'], $php_maxsize), 1, array(), false);
} elseif ($_FILES['goods_img']['error'] == 2) {
sys_msg(sprintf($_LANG['goods_img_too_big'], $htm_maxsize), 1, array(), false);
}
// 商品缩略图
if (isset($_FILES['goods_thumb'])) {
if ($_FILES['goods_thumb']['error'] == 0) {
if (!$image->check_img_type($_FILES['goods_thumb']['type'])) {
sys_msg($_LANG['invalid_goods_thumb'], 1, array(), false);
}
} elseif ($_FILES['goods_thumb']['error'] == 1) {
sys_msg(sprintf($_LANG['goods_thumb_too_big'], $php_maxsize), 1, array(), false);
示例4: elseif
} elseif (empty($img)) {
$error = '图片不能为空';
} elseif (empty($adArr['file'])) {
$error = '使用页面不能为空';
}
if (isset($error)) {
sys_msg($error, 0, $link);
}
$old_img = $db->getOne("SELECT img FROM " . $ecs->table('ad_new') . " WHERE ad_name = '{$adArr['ad_name']}'");
if ($db->getOne("SELECT id FROM " . $ecs->table('ad_new') . " WHERE ad_name = '{$adArr['ad_name']}' AND id <> {$id} AND admin_agency_id = {$adArr['admin_agency_id']}")) {
sys_msg('广告名称已存在', 0, $link);
}
if (isset($img['error']) && $img['error'] == 0) {
$image = new cls_image($_CFG['bgcolor']);
//实例化图片处理函数
if ($image->check_img_type($img['type'])) {
$img_name = $image->upload_image($img, '');
}
if (!$img_name) {
sys_msg('上传图片失败', 1);
}
$adArr['img'] = $img_name;
if (!$db->getOne("SELECT id FROM " . $ecs->table('ad_new') . " WHERE img ='{$old_img}' AND id<>{$id}")) {
@unlink('../' . $old_img);
}
}
if (!isset($adArr['img'])) {
$adArr['img'] = $outer_img;
}
$db->autoExecute($ecs->table('ad_new'), $adArr, 'update', "id = {$id}");
/* 记录管理员操作 */
示例5: elseif
$db->query($sql);
}
if (!empty($qq) && !preg_match('/^\\d+$/', $qq)) {
show_message($_LANG['passport_js']['qq_invalid']);
}
if (!empty($mobile_phone) && !preg_match('/^[\\d-\\s]+$/', $mobile_phone)) {
show_message($_LANG['passport_js']['mobile_phone_invalid']);
}
/* 检查图片:如果有错误,检查尺寸是否超过最大值;否则,检查文件类型 */
if (isset($_FILES['avatar']['error'])) {
// 最大上传文件大小
$php_maxsize = ini_get('upload_max_filesize');
$htm_maxsize = '1M';
// 会员头像
if ($_FILES['avatar']['error'] == 0) {
if (!$image->check_img_type($_FILES['avatar']['type'])) {
show_message("图片格式不正确!");
}
} elseif ($_FILES['avatar']['error'] == 1) {
show_message(sprintf('图片文件太大了(最大值:1M),无法上传。', $php_maxsize), $_LANG['profile_lnk'], 'user.php?act=profile', 'info');
} elseif ($_FILES['avatar']['error'] == 2) {
show_message(sprintf('图片文件太大了(最大值:1M),无法上传。', $htm_maxsize), $_LANG['profile_lnk'], 'user.php?act=profile', 'info');
}
} else {
// 会员头像
if ($_FILES['avatar']['tmp_name'] != 'none') {
if (!$image->check_img_type($_FILES['avatar']['type'])) {
show_message("图片格式不正确!");
}
}
}
示例6: isset
$id = isset($_REQUEST['id']) ? intval($_REQUEST['id']) : '';
$link = 'pay.php?act=edit_show_bank&id=' . $id;
if (!$id) {
sys_msg('参数错误', 1);
}
if (!empty($_POST)) {
$image = new cls_image($_CFG['bgcolor']);
//实例化图片处理函数
$bank_name = isset($_POST['bank_name']) ? $_POST['bank_name'] : '';
$bank_code = isset($_POST['bank_code']) ? $_POST['bank_code'] : '';
$bank_image = isset($_FILES['bank_image']) ? $_FILES['bank_image'] : '';
$payment = isset($_POST['payment']) ? $_POST['payment'] : '';
$status = isset($_POST['status']) ? $_POST['status'] : '0';
$bank_img_name = '';
if (isset($bank_image['error']) && $bank_image['error'] == 0) {
if ($image->check_img_type($bank_image['type'])) {
$bank_img_name = $image->upload_image($bank_image, '');
}
if (!$bank_img_name) {
sys_msg('上传图片失败', 1);
}
}
if ($bank_img_name) {
$bank_img = ',bank_img = "' . $bank_img_name . '"';
}
$res = $db->query("update " . $ecs->table('show_bank') . " set bank_name = '{$bank_name}', bank_code = '{$bank_code}',state='{$status}',payment='{$payment}' {$bank_img} where id = {$id}");
if ($res) {
sys_msg('修改成功', 0, array(array('href' => 'pay.php?act=show_bank', 'text' => '返回')));
} else {
sys_msg('修改失败', 1, array(array('href' => $link, 'text' => '返回')));
}
示例7: array
}
$links[] = array('text' => '套餐列表', 'href' => 'system_taocan.php?act=list');
sys_msg($_LANG['attradd_succed'], 1, $links);
exit;
}
if ($_REQUEST['act'] == 'update') {
$taocan['tname'] = $_POST['tname'];
$taocan['tprice'] = trim($_POST['tprice']);
$taocan['descs'] = empty($_POST['desc']) ? '' : $_POST['desc'];
$taocan['last_date'] = gmtime();
$id = trim($_POST['id']);
include_once ROOT_PATH . '/includes/cls_image.php';
$image = new cls_image($_CFG['bgcolor']);
foreach ($_FILES['tpic']['tmp_name'] as $key => $value) {
if ($value != 'none' && $value) {
if (!$image->check_img_type($_FILES['tpic']['type'][$key])) {
$links[] = array('text' => '返会套餐列表', 'href' => 'system_taocan.php?act=list');
sys_msg('无效的图片格式:' . $_FILES['tpic']['type'][$key], 1, $links);
}
}
}
foreach ($_FILES['tpic']['size'] as $key => $value) {
if ($value) {
if ($value / 1024 / 1024 > 4) {
$links[] = array('text' => '返会套餐列表', 'href' => 'system_taocan.php?act=list');
sys_msg('图片大于4M:' . $_FILES['tpic']['name'][$key], 1, $links);
}
}
}
foreach ($_FILES['tpic']['tmp_name'] as $key => $value) {
if ($value) {
示例8: elseif
$error = '没有上传图片!';
} elseif (empty($info['title_describe'])) {
$error = '没有填写标题描述!';
}
$link[0]['text'] = '管理资讯信息';
$link[0]['href'] = 'information.php?act=list';
$link[1]['text'] = '继续添加资讯信息';
$link[1]['href'] = 'information.php?act=add';
if (isset($error)) {
sys_msg($error, 0, $link, false);
}
if ($db->getOne("SELECT info_id FROM " . $ecs->table('information') . " WHERE title_describe = '" . $info['title_describe'] . "'")) {
sys_msg('本资讯名称已存在', 0, $link, false);
}
if (isset($img_file['error']) && $img_file['error'] == 0) {
if ($image->check_img_type($img_file['type'])) {
$info['img_file'] = $image->upload_image($img_file, '');
}
if (!$info['img_file']) {
sys_msg('上传图片失败', 1);
}
}
$db->autoExecute($ecs->table('information'), $info, 'INSERT');
/* 记录管理员操作 */
admin_log($_POST['info_cat'], 'add', 'information');
clear_cache_files();
// 清除缓存文件
/* 提示信息 */
sys_msg($_LANG['add'] . " " . $info['title_describe'] . " " . $_LANG['attradd_succed'], 0, $link, false);
} elseif ($_REQUEST['act'] == 'edit') {
admin_priv('information');