本文整理匯總了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');