当前位置: 首页>>代码示例>>PHP>>正文


PHP save_image_upload函数代码示例

本文整理汇总了PHP中save_image_upload函数的典型用法代码示例。如果您正苦于以下问题:PHP save_image_upload函数的具体用法?PHP save_image_upload怎么用?PHP save_image_upload使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了save_image_upload函数的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: index

 public function index()
 {
     require_once APP_ROOT_PATH . "system/libs/user.php";
     $root = array();
     $user_data = $GLOBALS['user_info'];
     if (intval($user_data['id']) == 0) {
         $root['return'] = 0;
         $root['info'] = "请先登录";
         output($root);
     }
     if (isset($_FILES['image_1'])) {
         //开始上传
         //创建avatar临时目录
         if (!is_dir(APP_ROOT_PATH . "public/avatar")) {
             @mkdir(APP_ROOT_PATH . "public/avatar");
             @chmod(APP_ROOT_PATH . "public/avatar", 0777);
         }
         if (!is_dir(APP_ROOT_PATH . "public/avatar/temp")) {
             @mkdir(APP_ROOT_PATH . "public/avatar/temp");
             @chmod(APP_ROOT_PATH . "public/avatar/temp", 0777);
         }
         $img_result = save_image_upload($_FILES, "image_1", "avatar/temp", $whs = array('small' => array(48, 48, 1, 0), 'middle' => array(120, 120, 1, 0), 'big' => array(200, 200, 1, 0)));
         //开始移动图片到相应位置
         $id = intval($user_data['id']);
         $uid = sprintf("%09d", $id);
         $dir1 = substr($uid, 0, 3);
         $dir2 = substr($uid, 3, 2);
         $dir3 = substr($uid, 5, 2);
         $path = $dir1 . '/' . $dir2 . '/' . $dir3;
         //创建相应的目录
         if (!is_dir(APP_ROOT_PATH . "public/avatar/" . $dir1)) {
             @mkdir(APP_ROOT_PATH . "public/avatar/" . $dir1);
             @chmod(APP_ROOT_PATH . "public/avatar/" . $dir1, 0777);
         }
         if (!is_dir(APP_ROOT_PATH . "public/avatar/" . $dir1 . '/' . $dir2)) {
             @mkdir(APP_ROOT_PATH . "public/avatar/" . $dir1 . '/' . $dir2);
             @chmod(APP_ROOT_PATH . "public/avatar/" . $dir1 . '/' . $dir2, 0777);
         }
         if (!is_dir(APP_ROOT_PATH . "public/avatar/" . $dir1 . '/' . $dir2 . '/' . $dir3)) {
             @mkdir(APP_ROOT_PATH . "public/avatar/" . $dir1 . '/' . $dir2 . '/' . $dir3);
             @chmod(APP_ROOT_PATH . "public/avatar/" . $dir1 . '/' . $dir2 . '/' . $dir3, 0777);
         }
         $id = str_pad($id, 2, "0", STR_PAD_LEFT);
         $id = substr($id, -2);
         $avatar_file_big = APP_ROOT_PATH . "public/avatar/" . $path . "/" . $id . "virtual_avatar_big.jpg";
         $avatar_file_middle = APP_ROOT_PATH . "public/avatar/" . $path . "/" . $id . "virtual_avatar_middle.jpg";
         $avatar_file_small = APP_ROOT_PATH . "public/avatar/" . $path . "/" . $id . "virtual_avatar_small.jpg";
         @file_put_contents($avatar_file_big, file_get_contents($img_result['image_1']['thumb']['big']['path']));
         @file_put_contents($avatar_file_middle, file_get_contents($img_result['image_1']['thumb']['middle']['path']));
         @file_put_contents($avatar_file_small, file_get_contents($img_result['image_1']['thumb']['small']['path']));
         @unlink($img_result['image_1']['thumb']['big']['path']);
         @unlink($img_result['image_1']['thumb']['middle']['path']);
         @unlink($img_result['image_1']['thumb']['small']['path']);
         @unlink($img_result['image_1']['path']);
         //end 上传
     }
     $root['return'] = 1;
     $root['user_avatar'] = get_abs_img_root(get_muser_avatar($user_data['id'], "big"));
     output($root);
 }
开发者ID:macall,项目名称:jsd,代码行数:60,代码来源:avatar.action.php

示例2: index

 public function index()
 {
     $email = addslashes($GLOBALS['request']['email']);
     //用户名或邮箱
     $pwd = addslashes($GLOBALS['request']['pwd']);
     //密码
     //检查用户,用户密码
     $user_info = user_check($email, $pwd);
     $user_id = intval($user_info['id']);
     if (!$user_info) {
         $root['status'] = 0;
         $root['message'] = "用户已失效,无法上传";
         output($root);
     } else {
         //上传
         $content = addslashes(htmlspecialchars(trim($GLOBALS['request']['content'])));
         if ($content == '') {
             $root['status'] = 0;
             $root['message'] = "发布内容不能为空";
             output($root);
         }
         $dir = "u_" . to_date(get_gmtime(), "Ym");
         if (!is_dir(APP_ROOT_PATH . "public/attachment/" . $dir)) {
             @mkdir(APP_ROOT_PATH . "public/attachment/" . $dir);
             @chmod(APP_ROOT_PATH . "public/attachment/" . $dir, 0777);
         }
         $img_result = save_image_upload($_FILES, 'image_1', 'attachment/' . $dir, array('origin' => array(0, 0, 0, 0)), 0, 1);
         if (intval($img_result['error']) != 0) {
             $root['status'] = 0;
             $root['message'] = "图片上传失败:" . $img_result['message'];
             output($root);
         }
         $image_1 = $img_result['image_1']['url'];
         $youhui['user_id'] = $user_id;
         $youhui['icon'] = $image_1;
         $youhui['image'] = $image_1;
         $youhui['is_effect'] = 0;
         $youhui['name'] = $content;
         $youhui['content'] = $content;
         $youhui['create_time'] = get_gmtime();
         $youhui['pub_by'] = 1;
         $GLOBALS['db']->autoExecute(DB_PREFIX . "youhui", $youhui, 'INSERT');
         $id = $GLOBALS['db']->insert_id();
         if ($id) {
             $root['status'] = 1;
             $root['message'] = "发布信息成功";
             output($root);
         } else {
             $root['status'] = 0;
             $root['message'] = "发布信息失败,请稍候再发";
             output($root);
         }
         //上传
     }
 }
开发者ID:YouthAndra,项目名称:huaitaoo2o,代码行数:55,代码来源:uploadyouhui.action.php

示例3: to_date

    @chmod(APP_ROOT_PATH . "public/attachment/" . $dir, 0777);
}
$dir = $dir . "/" . to_date(get_gmtime(), "d");
if (!is_dir(APP_ROOT_PATH . "public/attachment/" . $dir)) {
    @mkdir(APP_ROOT_PATH . "public/attachment/" . $dir);
    @chmod(APP_ROOT_PATH . "public/attachment/" . $dir, 0777);
}
$dir = $dir . "/" . to_date(get_gmtime(), "H");
if (!is_dir(APP_ROOT_PATH . "public/attachment/" . $dir)) {
    @mkdir(APP_ROOT_PATH . "public/attachment/" . $dir);
    @chmod(APP_ROOT_PATH . "public/attachment/" . $dir, 0777);
}
if (app_conf("IS_WATER_MARK") == 1) {
    $img_result = save_image_upload($_FILES, "identify_business_licence", "attachment/" . $dir, $whs = array('thumb' => array(205, 160, 1, 0)), 1, 1);
} else {
    $img_result = save_image_upload($_FILES, "identify_business_licence", "attachment/" . $dir, $whs = array('thumb' => array(205, 160, 1, 0)), 0, 1);
}
if (intval($img_result['error']) != 0) {
    $data['status'] = 0;
    //未登录
    $data['msg'] = $img_result['message'];
    ajax_return($data);
} else {
    if (app_conf("PUBLIC_DOMAIN_ROOT") != '') {
        $paths = pathinfo($img_result['imgFile']['url']);
        $path = str_replace("./", "", $paths['dirname']);
        $filename = $paths['basename'];
        $pathwithoupublic = str_replace("public/", "", $path);
        $syn_url = app_conf("PUBLIC_DOMAIN_ROOT") . "/es_file.php?username=" . app_conf("IMAGE_USERNAME") . "&password=" . app_conf("IMAGE_PASSWORD") . "&file=" . get_domain() . APP_ROOT . "/" . $path . "/" . $filename . "&path=" . $pathwithoupublic . "/&name=" . $filename . "&act=0";
        @file_get_contents($syn_url);
    }
开发者ID:xinlechou,项目名称:wap,代码行数:31,代码来源:upload_agency_one.php

示例4: upload

 public function upload()
 {
     if ($GLOBALS['user_info']['id'] == 0) {
         $data['status'] = 0;
         //未登录
         $data['msg'] = "请先登录";
         ajax_return($data);
     }
     //上传处理
     //创建avatar临时目录
     if (!is_dir(APP_ROOT_PATH . "public/avatar")) {
         @mkdir(APP_ROOT_PATH . "public/avatar");
         @chmod(APP_ROOT_PATH . "public/avatar", 0777);
     }
     if (!is_dir(APP_ROOT_PATH . "public/avatar/temp")) {
         @mkdir(APP_ROOT_PATH . "public/avatar/temp");
         @chmod(APP_ROOT_PATH . "public/avatar/temp", 0777);
     }
     $upd_id = $id = intval($_REQUEST['uid']);
     if (is_animated_gif($_FILES['avatar_file']['tmp_name'])) {
         $rs = save_image_upload($_FILES, "avatar_file", "avatar/temp", $whs = array());
         $im = get_spec_gif_anmation($rs['avatar_file']['path'], 48, 48);
         $file_name = APP_ROOT_PATH . "public/avatar/temp/" . md5(NOW_TIME . $upd_id) . "_small.jpg";
         file_put_contents($file_name, $im);
         $img_result['avatar_file']['thumb']['small']['path'] = $file_name;
         $im = get_spec_gif_anmation($rs['avatar_file']['path'], 120, 120);
         $file_name = APP_ROOT_PATH . "public/avatar/temp/" . md5(NOW_TIME . $upd_id) . "_middle.jpg";
         file_put_contents($file_name, $im);
         $img_result['avatar_file']['thumb']['middle']['path'] = $file_name;
         $im = get_spec_gif_anmation($rs['avatar_file']['path'], 200, 200);
         $file_name = APP_ROOT_PATH . "public/avatar/temp/" . md5(NOW_TIME . $upd_id) . "_big.jpg";
         file_put_contents($file_name, $im);
         $img_result['avatar_file']['thumb']['big']['path'] = $file_name;
     } else {
         $img_result = save_image_upload($_FILES, "avatar_file", "avatar/temp", $whs = array('small' => array(48, 48, 1, 0), 'middle' => array(120, 120, 1, 0), 'big' => array(200, 200, 1, 0)));
     }
     //开始移动图片到相应位置
     $uid = sprintf("%09d", $id);
     $dir1 = substr($uid, 0, 3);
     $dir2 = substr($uid, 3, 2);
     $dir3 = substr($uid, 5, 2);
     $path = $dir1 . '/' . $dir2 . '/' . $dir3;
     //创建相应的目录
     if (!is_dir(APP_ROOT_PATH . "public/avatar/" . $dir1)) {
         @mkdir(APP_ROOT_PATH . "public/avatar/" . $dir1);
         @chmod(APP_ROOT_PATH . "public/avatar/" . $dir1, 0777);
     }
     if (!is_dir(APP_ROOT_PATH . "public/avatar/" . $dir1 . '/' . $dir2)) {
         @mkdir(APP_ROOT_PATH . "public/avatar/" . $dir1 . '/' . $dir2);
         @chmod(APP_ROOT_PATH . "public/avatar/" . $dir1 . '/' . $dir2, 0777);
     }
     if (!is_dir(APP_ROOT_PATH . "public/avatar/" . $dir1 . '/' . $dir2 . '/' . $dir3)) {
         @mkdir(APP_ROOT_PATH . "public/avatar/" . $dir1 . '/' . $dir2 . '/' . $dir3);
         @chmod(APP_ROOT_PATH . "public/avatar/" . $dir1 . '/' . $dir2 . '/' . $dir3, 0777);
     }
     $id = str_pad($id, 2, "0", STR_PAD_LEFT);
     $id = substr($id, -2);
     $avatar_file_big = APP_ROOT_PATH . "public/avatar/" . $path . "/" . $id . "virtual_avatar_big.jpg";
     $avatar_file_middle = APP_ROOT_PATH . "public/avatar/" . $path . "/" . $id . "virtual_avatar_middle.jpg";
     $avatar_file_small = APP_ROOT_PATH . "public/avatar/" . $path . "/" . $id . "virtual_avatar_small.jpg";
     @file_put_contents($avatar_file_big, file_get_contents($img_result['avatar_file']['thumb']['big']['path']));
     @file_put_contents($avatar_file_middle, file_get_contents($img_result['avatar_file']['thumb']['middle']['path']));
     @file_put_contents($avatar_file_small, file_get_contents($img_result['avatar_file']['thumb']['small']['path']));
     @unlink($img_result['avatar_file']['thumb']['big']['path']);
     @unlink($img_result['avatar_file']['thumb']['middle']['path']);
     @unlink($img_result['avatar_file']['thumb']['small']['path']);
     @unlink($img_result['avatar_file']['path']);
     //上传成功更新用户头像的动态缓存
     update_avatar($upd_id);
     $data['status'] = 1;
     $data['small_url'] = get_user_avatar($upd_id, "small");
     $data['middle_url'] = get_user_avatar($upd_id, "middle");
     $data['big_url'] = get_user_avatar($upd_id, "big");
     ajax_return($data);
 }
开发者ID:xcdxcd,项目名称:zhongchou,代码行数:75,代码来源:avatarModule.class.php

示例5: index

 public function index()
 {
     require_once APP_ROOT_PATH . "system/libs/user.php";
     $root = array();
     $email = strim($GLOBALS['request']['email']);
     //用户名或邮箱
     $pwd = strim($GLOBALS['request']['pwd']);
     //密码
     //检查用户,用户密码
     $user = user_check($email, $pwd);
     $user_id = intval($user['id']);
     if ($user_id > 0) {
         $root['user_login_status'] = 1;
         $root['response_code'] = 1;
         if (!check_ipop_limit(get_client_ip(), "setting_save_index", 5)) {
             $root['show_err'] = "提交太频繁";
         }
         require_once APP_ROOT_PATH . "system/libs/user.php";
         $user_data = array();
         $user_data['province'] = strim($_REQUEST['province']);
         $user_data['city'] = strim($_REQUEST['city']);
         $user_data['sex'] = intval($_REQUEST['sex']);
         $user_data['intro'] = strim($_REQUEST['intro']);
         $GLOBALS['db']->autoExecute(DB_PREFIX . "user", $user_data, "UPDATE", "id=" . intval($GLOBALS['user_info']['id']));
         $GLOBALS['db']->query("delete from " . DB_PREFIX . "user_weibo where user_id = " . intval($GLOBALS['user_info']['id']));
         $weibo_data = array();
         $weibo_data['user_id'] = intval($GLOBALS['user_info']['id']);
         $weibo_data['weibo_url'] = strim($_REQUEST['weibo_url']);
         $GLOBALS['db']->autoExecute(DB_PREFIX . "user_weibo", $weibo_data);
         //$root['image'] =$GLOBALS['m_config']['page_size'];
         //	showSuccess("资料保存成功",$ajax,url('settings#index'));
         //			file_put_contents(APP_ROOT_PATH."public/test.txt", print_r($_FILES, 1));
         if (isset($_FILES['image_1'])) {
             //开始上传
             //创建avatar临时目录
             if (!is_dir(APP_ROOT_PATH . "public/avatar")) {
                 @mkdir(APP_ROOT_PATH . "public/avatar");
                 @chmod(APP_ROOT_PATH . "public/avatar", 0777);
             }
             if (!is_dir(APP_ROOT_PATH . "public/avatar/temp")) {
                 @mkdir(APP_ROOT_PATH . "public/avatar/temp");
                 @chmod(APP_ROOT_PATH . "public/avatar/temp", 0777);
             }
             $img_result = save_image_upload($_FILES, "image_1", "avatar/temp", $whs = array('small' => array(48, 48, 1, 0), 'middle' => array(120, 120, 1, 0), 'big' => array(200, 200, 1, 0)));
             //开始移动图片到相应位置
             $id = intval($user['id']);
             $uid = sprintf("%09d", $id);
             $dir1 = substr($uid, 0, 3);
             $dir2 = substr($uid, 3, 2);
             $dir3 = substr($uid, 5, 2);
             $path = $dir1 . '/' . $dir2 . '/' . $dir3;
             //创建相应的目录
             if (!is_dir(APP_ROOT_PATH . "public/avatar/" . $dir1)) {
                 @mkdir(APP_ROOT_PATH . "public/avatar/" . $dir1);
                 @chmod(APP_ROOT_PATH . "public/avatar/" . $dir1, 0777);
             }
             if (!is_dir(APP_ROOT_PATH . "public/avatar/" . $dir1 . '/' . $dir2)) {
                 @mkdir(APP_ROOT_PATH . "public/avatar/" . $dir1 . '/' . $dir2);
                 @chmod(APP_ROOT_PATH . "public/avatar/" . $dir1 . '/' . $dir2, 0777);
             }
             if (!is_dir(APP_ROOT_PATH . "public/avatar/" . $dir1 . '/' . $dir2 . '/' . $dir3)) {
                 @mkdir(APP_ROOT_PATH . "public/avatar/" . $dir1 . '/' . $dir2 . '/' . $dir3);
                 @chmod(APP_ROOT_PATH . "public/avatar/" . $dir1 . '/' . $dir2 . '/' . $dir3, 0777);
             }
             $id = str_pad($id, 2, "0", STR_PAD_LEFT);
             $id = substr($id, -2);
             $avatar_file_big = APP_ROOT_PATH . "public/avatar/" . $path . "/" . $id . "virtual_avatar_big.jpg";
             $avatar_file_middle = APP_ROOT_PATH . "public/avatar/" . $path . "/" . $id . "virtual_avatar_middle.jpg";
             $avatar_file_small = APP_ROOT_PATH . "public/avatar/" . $path . "/" . $id . "virtual_avatar_small.jpg";
             //	file_put_contents(APP_ROOT_PATH."public/test1.txt", print_r($avatar_file_small, 1));
             @file_put_contents($avatar_file_big, file_get_contents($img_result['image_1']['thumb']['big']['path']));
             @file_put_contents($avatar_file_middle, file_get_contents($img_result['image_1']['thumb']['middle']['path']));
             @file_put_contents($avatar_file_small, file_get_contents($img_result['image_1']['thumb']['small']['path']));
             @unlink($img_result['image_1']['thumb']['big']['path']);
             @unlink($img_result['image_1']['thumb']['middle']['path']);
             @unlink($img_result['image_1']['thumb']['small']['path']);
             @unlink($img_result['image_1']['path']);
             //end 上传
         }
         $root['user_avatar'] = get_abs_img_root(get_muser_avatar($user['id'], "big"));
         $root['info'] = "资料保存成功";
     } else {
         $root['response_code'] = 0;
         $root['show_err'] = "未登录";
         $root['user_login_status'] = 0;
     }
     output($root);
 }
开发者ID:myjavawork,项目名称:sanxin-fangwei,代码行数:88,代码来源:uc_save_userinfo.action.php

示例6: to_date

    @chmod(APP_ROOT_PATH . "public/attachment/" . $dir, 0777);
}
$dir = $dir . "/" . to_date(get_gmtime(), "d");
if (!is_dir(APP_ROOT_PATH . "public/attachment/" . $dir)) {
    @mkdir(APP_ROOT_PATH . "public/attachment/" . $dir);
    @chmod(APP_ROOT_PATH . "public/attachment/" . $dir, 0777);
}
$dir = $dir . "/" . to_date(get_gmtime(), "H");
if (!is_dir(APP_ROOT_PATH . "public/attachment/" . $dir)) {
    @mkdir(APP_ROOT_PATH . "public/attachment/" . $dir);
    @chmod(APP_ROOT_PATH . "public/attachment/" . $dir, 0777);
}
if (app_conf("IS_WATER_MARK") == 1) {
    $img_result = save_image_upload($_FILES, "image_file", "attachment/" . $dir, $whs = array('thumb' => array(50, 50, 1, 0)), 1, 1);
} else {
    $img_result = save_image_upload($_FILES, "image_file", "attachment/" . $dir, $whs = array('thumb' => array(50, 50, 1, 0)), 0, 1);
}
if (intval($img_result['error']) != 0) {
    $data['status'] = 0;
    //未登录
    $data['msg'] = $img_result['message'];
    ajax_return($data);
} else {
    if (app_conf("PUBLIC_DOMAIN_ROOT") != '') {
        $paths = pathinfo($img_result['imgFile']['url']);
        $path = str_replace("./", "", $paths['dirname']);
        $filename = $paths['basename'];
        $pathwithoupublic = str_replace("public/", "", $path);
        $syn_url = app_conf("PUBLIC_DOMAIN_ROOT") . "/es_file.php?username=" . app_conf("IMAGE_USERNAME") . "&password=" . app_conf("IMAGE_PASSWORD") . "&file=" . get_domain() . APP_ROOT . "/" . $path . "/" . $filename . "&path=" . $pathwithoupublic . "/&name=" . $filename . "&act=0";
        @file_get_contents($syn_url);
    }
开发者ID:myjavawork,项目名称:sanxin-fangwei,代码行数:31,代码来源:upload_item.php

示例7: step4

 public function step4()
 {
     check_issupplier();
     $user_id = intval($GLOBALS['user_info']['id']);
     if ($user_id == 0) {
         app_redirect(url("shop", "user#login"));
     }
     //		print_r( unserialize(base64_decode($_REQUEST['base_data'])));exit;
     //上传处理
     //创建attachment目录
     if ($_POST) {
         if (!is_dir(APP_ROOT_PATH . "public/attachment")) {
             @mkdir(APP_ROOT_PATH . "public/attachment");
             @chmod(APP_ROOT_PATH . "public/attachment", 0777);
         }
         $dir = to_date(get_gmtime(), "Ym");
         if (!is_dir(APP_ROOT_PATH . "public/attachment/" . $dir)) {
             @mkdir(APP_ROOT_PATH . "public/attachment/" . $dir);
             @chmod(APP_ROOT_PATH . "public/attachment/" . $dir, 0777);
         }
         $dir = $dir . "/" . to_date(get_gmtime(), "d");
         if (!is_dir(APP_ROOT_PATH . "public/attachment/" . $dir)) {
             @mkdir(APP_ROOT_PATH . "public/attachment/" . $dir);
             @chmod(APP_ROOT_PATH . "public/attachment/" . $dir, 0777);
         }
         $dir = $dir . "/" . to_date(get_gmtime(), "H");
         if (!is_dir(APP_ROOT_PATH . "public/attachment/" . $dir)) {
             @mkdir(APP_ROOT_PATH . "public/attachment/" . $dir);
             @chmod(APP_ROOT_PATH . "public/attachment/" . $dir, 0777);
         }
         if ($_FILES['h_license']['name'] != "") {
             $image_res = save_image_upload($_FILES, "h_license", "attachment/" . $dir, $whs = array(), 0, 1);
             if (intval($image_res['error']) != 0) {
                 $messages[] = "营业执照图片" . $image_res['message'];
             } else {
                 if (app_conf("PUBLIC_DOMAIN_ROOT") != '') {
                     $paths = pathinfo($image_res['h_license']['url']);
                     $path = str_replace("./", "", $paths['dirname']);
                     $filename = $paths['basename'];
                     $pathwithoupublic = str_replace("public/", "", $path);
                     $syn_url = app_conf("PUBLIC_DOMAIN_ROOT") . "/es_file.php?username=" . app_conf("IMAGE_USERNAME") . "&password=" . app_conf("IMAGE_PASSWORD") . "&file=" . get_domain() . APP_ROOT . "/" . $path . "/" . $filename . "&path=" . $pathwithoupublic . "/&name=" . $filename . "&act=0";
                     @file_get_contents($syn_url);
                 }
                 $save_data['h_license'] = $image_res['h_license']['url'];
             }
         } else {
             $messages[] = "营业执照必需上传";
         }
         if ($_FILES['h_other_license']['name'] != "") {
             $image_res = save_image_upload($_FILES, "h_other_license", "attachment/" . $dir, $whs = array(), 0, 1);
             if (intval($image_res['error']) != 0) {
                 $messages[] = "其他资质图片" . $image_res['message'];
             } else {
                 if (app_conf("PUBLIC_DOMAIN_ROOT") != '') {
                     $paths = pathinfo($image_res['h_other_license']['url']);
                     $path = str_replace("./", "", $paths['dirname']);
                     $filename = $paths['basename'];
                     $pathwithoupublic = str_replace("public/", "", $path);
                     $syn_url = app_conf("PUBLIC_DOMAIN_ROOT") . "/es_file.php?username=" . app_conf("IMAGE_USERNAME") . "&password=" . app_conf("IMAGE_PASSWORD") . "&file=" . get_domain() . APP_ROOT . "/" . $path . "/" . $filename . "&path=" . $pathwithoupublic . "/&name=" . $filename . "&act=0";
                     @file_get_contents($syn_url);
                 }
                 $save_data['h_other_license'] = $image_res['h_other_license']['url'];
             }
         }
         if ($_FILES['h_supplier_logo']['name'] != "") {
             $image_res = save_image_upload($_FILES, "h_supplier_logo", "attachment/" . $dir, $whs = array(), 0, 1);
             if (intval($image_res['error']) != 0) {
                 $messages[] = "商家logo" . $image_res['message'];
             } else {
                 if (app_conf("PUBLIC_DOMAIN_ROOT") != '') {
                     $paths = pathinfo($image_res['h_supplier_logo']['url']);
                     $path = str_replace("./", "", $paths['dirname']);
                     $filename = $paths['basename'];
                     $pathwithoupublic = str_replace("public/", "", $path);
                     $syn_url = app_conf("PUBLIC_DOMAIN_ROOT") . "/es_file.php?username=" . app_conf("IMAGE_USERNAME") . "&password=" . app_conf("IMAGE_PASSWORD") . "&file=" . get_domain() . APP_ROOT . "/" . $path . "/" . $filename . "&path=" . $pathwithoupublic . "/&name=" . $filename . "&act=0";
                     @file_get_contents($syn_url);
                 }
                 $save_data['h_supplier_logo'] = $image_res['h_supplier_logo']['url'];
             }
         }
         if ($_FILES['h_supplier_image']['name'] != "") {
             $image_res = save_image_upload($_FILES, "h_supplier_image", "attachment/" . $dir, $whs = array(), 0, 1);
             if (intval($image_res['error']) != 0) {
                 $messages[] = "门店图片" . $image_res['message'];
             } else {
                 if (app_conf("PUBLIC_DOMAIN_ROOT") != '') {
                     $paths = pathinfo($image_res['h_supplier_image']['url']);
                     $path = str_replace("./", "", $paths['dirname']);
                     $filename = $paths['basename'];
                     $pathwithoupublic = str_replace("public/", "", $path);
                     $syn_url = app_conf("PUBLIC_DOMAIN_ROOT") . "/es_file.php?username=" . app_conf("IMAGE_USERNAME") . "&password=" . app_conf("IMAGE_PASSWORD") . "&file=" . get_domain() . APP_ROOT . "/" . $path . "/" . $filename . "&path=" . $pathwithoupublic . "/&name=" . $filename . "&act=0";
                     @file_get_contents($syn_url);
                 }
                 $save_data['h_supplier_image'] = $image_res['h_supplier_image']['url'];
             }
         }
         if (count($messages) == 0) {
             $base_data = unserialize(base64_decode($_REQUEST['base_data']));
             $save_data['name'] = $base_data['name'];
             $save_data['cate_config'] = serialize(array('deal_cate_id' => $base_data['deal_cate_id'], 'deal_cate_type_id' => $base_data['deal_cate_type_id']));
//.........这里部分代码省略.........
开发者ID:YouthAndra,项目名称:huaitaoo2o,代码行数:101,代码来源:joinModule.class.php

示例8: to_date

    @chmod(APP_ROOT_PATH . "public/comment/" . $dir, 0777);
}
$dir = $dir . "/" . to_date(TIME_UTC, "d");
if (!is_dir(APP_ROOT_PATH . "public/comment/" . $dir)) {
    @mkdir(APP_ROOT_PATH . "public/comment/" . $dir);
    @chmod(APP_ROOT_PATH . "public/comment/" . $dir, 0777);
}
$dir = $dir . "/" . to_date(TIME_UTC, "H");
if (!is_dir(APP_ROOT_PATH . "public/comment/" . $dir)) {
    @mkdir(APP_ROOT_PATH . "public/comment/" . $dir);
    @chmod(APP_ROOT_PATH . "public/comment/" . $dir, 0777);
}
if (app_conf("IS_WATER_MARK") == 1) {
    $img_result = save_image_upload($_FILES, "topic_image", "comment/" . $dir, $whs = array('thumb' => array(100, 100, 1, 0)), 1, 1);
} else {
    $img_result = save_image_upload($_FILES, "topic_image", "comment/" . $dir, $whs = array('thumb' => array(100, 100, 1, 0)), 0, 1);
}
if (intval($img_result['error']) != 0) {
    ajax_return($img_result);
} else {
    if (app_conf("PUBLIC_DOMAIN_ROOT") != '') {
        $paths = pathinfo($img_result['topic_image']['url']);
        $path = str_replace("./", "", $paths['dirname']);
        $filename = $paths['basename'];
        $pathwithoupublic = str_replace("public/", "", $path);
        $syn_url = app_conf("PUBLIC_DOMAIN_ROOT") . "/es_file.php?username=" . app_conf("IMAGE_USERNAME") . "&password=" . app_conf("IMAGE_PASSWORD") . "&file=" . SITE_DOMAIN . APP_ROOT . "/" . $path . "/" . $filename . "&path=" . $pathwithoupublic . "/&name=" . $filename . "&act=0";
        @file_get_contents($syn_url);
    }
}
$data['error'] = 0;
$data['message'] = $img_result['topic_image']['thumb']['thumb']['url'];
开发者ID:norain2050,项目名称:fanwei_xindai_3.2,代码行数:31,代码来源:upload.php

示例9: index

 public function index()
 {
     require_once APP_ROOT_PATH . "system/libs/user.php";
     $root = array();
     $content = strim($GLOBALS['request']['content']);
     $source = strim($GLOBALS['request']['source']);
     $source = str_replace("来自", "", $source);
     $email = strim($GLOBALS['request']['email']);
     $pwd = strim($GLOBALS['request']['pwd']);
     $result = do_login_user($email, $pwd);
     $GLOBALS['user_info'] = $user_data = es_session::get('user_info');
     $user_data['id'] = intval($user_data['id']);
     if (intval($user_data['id']) == 0) {
         $root['return'] = 0;
         $root['info'] = "请先登录";
         output($root);
     }
     if (isset($_FILES['image_1'])) {
         //开始上传
         //上传处理
         //创建comment目录
         if (!is_dir(APP_ROOT_PATH . "public/comment")) {
             @mkdir(APP_ROOT_PATH . "public/comment");
             @chmod(APP_ROOT_PATH . "public/comment", 0777);
         }
         $dir = to_date(get_gmtime(), "Ym");
         if (!is_dir(APP_ROOT_PATH . "public/comment/" . $dir)) {
             @mkdir(APP_ROOT_PATH . "public/comment/" . $dir);
             @chmod(APP_ROOT_PATH . "public/comment/" . $dir, 0777);
         }
         $dir = $dir . "/" . to_date(get_gmtime(), "d");
         if (!is_dir(APP_ROOT_PATH . "public/comment/" . $dir)) {
             @mkdir(APP_ROOT_PATH . "public/comment/" . $dir);
             @chmod(APP_ROOT_PATH . "public/comment/" . $dir, 0777);
         }
         $dir = $dir . "/" . to_date(get_gmtime(), "H");
         if (!is_dir(APP_ROOT_PATH . "public/comment/" . $dir)) {
             @mkdir(APP_ROOT_PATH . "public/comment/" . $dir);
             @chmod(APP_ROOT_PATH . "public/comment/" . $dir, 0777);
         }
         if (app_conf("IS_WATER_MARK") == 1) {
             $img_result = save_image_upload($_FILES, "image_1", "comment/" . $dir, $whs = array('thumb' => array(100, 100, 1, 0)), 1, 1);
         } else {
             $img_result = save_image_upload($_FILES, "image_1", "comment/" . $dir, $whs = array('thumb' => array(100, 100, 1, 0)), 0, 1);
         }
         if (app_conf("PUBLIC_DOMAIN_ROOT") != '') {
             $paths = pathinfo($img_result['topic_image']['url']);
             $path = str_replace("./", "", $paths['dirname']);
             $filename = $paths['basename'];
             $pathwithoupublic = str_replace("public/", "", $path);
             $syn_url = app_conf("PUBLIC_DOMAIN_ROOT") . "/es_file.php?username=" . app_conf("IMAGE_USERNAME") . "&password=" . app_conf("IMAGE_PASSWORD") . "&file=" . get_domain() . APP_ROOT . "/" . $path . "/" . $filename . "&path=" . $pathwithoupublic . "/&name=" . $filename . "&act=0";
             @file_get_contents($syn_url);
         }
         require_once APP_ROOT_PATH . "system/utils/es_imagecls.php";
         $image = new es_imagecls();
         $info = $image->getImageInfo($img_result['image_1']['path']);
         $image_data['width'] = intval($info[0]);
         $image_data['height'] = intval($info[1]);
         $image_data['name'] = valid_str($_FILES['image_1']['name']);
         $image_data['filesize'] = filesize($img_result['image_1']['path']);
         $image_data['create_time'] = get_gmtime();
         $image_data['user_id'] = intval($GLOBALS['user_info']['id']);
         $image_data['user_name'] = addslashes($GLOBALS['user_info']['user_name']);
         $image_data['path'] = $img_result['image_1']['thumb']['thumb']['url'];
         $image_data['o_path'] = $img_result['image_1']['url'];
         $GLOBALS['db']->autoExecute(DB_PREFIX . "topic_image", $image_data);
         $image_id = intval($GLOBALS['db']->insert_id());
         //end 上传
     }
     if ($image_id > 0) {
         $attach_list = array(array("id" => $image_id, "type" => "image"));
     } else {
         $attach_list = array();
     }
     $id = insert_topic(valid_str($content), $title = "", $type = "", $group = "", $relay_id = 0, $fav_id = 0, $group_data = array(), $attach_list);
     if ($id) {
         increase_user_active($user_data['id'], "发表了一则分享");
         $GLOBALS['db']->query("update " . DB_PREFIX . "topic set source_name = '" . $source . "' where id = " . intval($id));
     }
     $syn_data['content'] = $content;
     //$syn_data['img'] = get_abs_img_root($GLOBALS['db']->getOne("select o_path from ".DB_PREFIX."topic_image where id = ".intval($image_id)));
     $syn_data['img'] = $GLOBALS['db']->getOne("select o_path from " . DB_PREFIX . "topic_image where id = " . intval($image_id));
     if ($syn_data['img']) {
         $syn_data['img'] = APP_ROOT_PATH . $syn_data['img'];
     }
     //开始同步
     if (intval($GLOBALS['request']['is_syn_sina'])) {
         //$GLOBALS['db']->query("update ".DB_PREFIX."user set is_syn_sina = 1 where id = ".intval($user_data['id']));
         //$func_name = strim($GLOBALS['request']['type'])."_Sina";
         //$result_sina = $func_name($syn_data);
         $result_sina = Sina($syn_data);
         $ext_info = "";
         if (!$result_sina['status']) {
             if (intval($result_sina['code']) == 21316 || intval($result_sina['code']) == 21317) {
                 $ext_info .= " 请先绑定新浪微博";
             }
             if (intval($result_sina['code']) == 21314 || intval($result_sina['code']) == 21315) {
                 $ext_info .= " 新浪微博授权过期";
             }
         }
//.........这里部分代码省略.........
开发者ID:YouthAndra,项目名称:huaitaoo2o,代码行数:101,代码来源:addshare.action.php

示例10: user_register_upload

 /**
  * 用户注册免登录调用上传
  */
 public function user_register_upload()
 {
     //上传处理
     //创建comment目录
     if (!is_dir(APP_ROOT_PATH . "public/attachment")) {
         @mkdir(APP_ROOT_PATH . "public/attachment");
         @chmod(APP_ROOT_PATH . "public/attachment", 0777);
     }
     $dir = to_date(NOW_TIME, "Ym");
     if (!is_dir(APP_ROOT_PATH . "public/attachment/" . $dir)) {
         @mkdir(APP_ROOT_PATH . "public/attachment/" . $dir);
         @chmod(APP_ROOT_PATH . "public/attachment/" . $dir, 0777);
     }
     $dir = $dir . "/" . to_date(NOW_TIME, "d");
     if (!is_dir(APP_ROOT_PATH . "public/attachment/" . $dir)) {
         @mkdir(APP_ROOT_PATH . "public/attachment/" . $dir);
         @chmod(APP_ROOT_PATH . "public/attachment/" . $dir, 0777);
     }
     $dir = $dir . "/" . to_date(NOW_TIME, "H");
     if (!is_dir(APP_ROOT_PATH . "public/attachment/" . $dir)) {
         @mkdir(APP_ROOT_PATH . "public/attachment/" . $dir);
         @chmod(APP_ROOT_PATH . "public/attachment/" . $dir, 0777);
     }
     if (app_conf("IS_WATER_MARK") == 1) {
         $img_result = save_image_upload($_FILES, "file", "attachment/" . $dir, $whs = array(), 1, 1);
     } else {
         $img_result = save_image_upload($_FILES, "file", "attachment/" . $dir, $whs = array(), 0, 1);
     }
     if (intval($img_result['error']) != 0) {
         ajax_return($img_result);
     } else {
         if ($GLOBALS['distribution_cfg']['OSS_TYPE'] && $GLOBALS['distribution_cfg']['OSS_TYPE'] != "NONE") {
             syn_to_remote_image_server($img_result['file']['url']);
         }
     }
     $data_result['error'] = 0;
     $data_result['url'] = $img_result['file']['url'];
     $data_result['small_url'] = get_spec_image($data_result['url'], 88, 75, 1);
     $data_result['big_url'] = get_spec_image($data_result['url'], 600, 400);
     $data_result['path'] = $img_result['file']['path'];
     $data_result['name'] = $img_result['file']['name'];
     ajax_return($data_result);
 }
开发者ID:macall,项目名称:jsd,代码行数:46,代码来源:fileModule.class.php

示例11: index

 public function index()
 {
     require_once APP_ROOT_PATH . "system/libs/user.php";
     $root = array();
     $email = strim($GLOBALS['request']['email']);
     //用户名或邮箱
     $pwd = strim($GLOBALS['request']['pwd']);
     //密码
     $GLOBALS['user_info'] = $user_data = es_session::get('user_info');
     //检查用户,用户密码
     $user = user_check($email, $pwd);
     $user_id = intval($user['id']);
     if ($user_id > 0) {
         if (isset($_FILES['image_1'])) {
             //开始上传
             //创建avatar临时目录
             if (!is_dir(APP_ROOT_PATH . "public/avatar")) {
                 @mkdir(APP_ROOT_PATH . "public/avatar");
                 @chmod(APP_ROOT_PATH . "public/avatar", 0777);
             }
             if (!is_dir(APP_ROOT_PATH . "public/avatar/temp")) {
                 @mkdir(APP_ROOT_PATH . "public/avatar/temp");
                 @chmod(APP_ROOT_PATH . "public/avatar/temp", 0777);
             }
             $img_result = save_image_upload($_FILES, "image_1", "avatar/temp", $whs = array('small' => array(48, 48, 1, 0), 'middle' => array(120, 120, 1, 0), 'big' => array(200, 200, 1, 0)));
             //开始移动图片到相应位置
             $id = intval($user_data['id']);
             $uid = sprintf("%09d", $id);
             $dir1 = substr($uid, 0, 3);
             $dir2 = substr($uid, 3, 2);
             $dir3 = substr($uid, 5, 2);
             $path = $dir1 . '/' . $dir2 . '/' . $dir3;
             //创建相应的目录
             if (!is_dir(APP_ROOT_PATH . "public/avatar/" . $dir1)) {
                 @mkdir(APP_ROOT_PATH . "public/avatar/" . $dir1);
                 @chmod(APP_ROOT_PATH . "public/avatar/" . $dir1, 0777);
             }
             if (!is_dir(APP_ROOT_PATH . "public/avatar/" . $dir1 . '/' . $dir2)) {
                 @mkdir(APP_ROOT_PATH . "public/avatar/" . $dir1 . '/' . $dir2);
                 @chmod(APP_ROOT_PATH . "public/avatar/" . $dir1 . '/' . $dir2, 0777);
             }
             if (!is_dir(APP_ROOT_PATH . "public/avatar/" . $dir1 . '/' . $dir2 . '/' . $dir3)) {
                 @mkdir(APP_ROOT_PATH . "public/avatar/" . $dir1 . '/' . $dir2 . '/' . $dir3);
                 @chmod(APP_ROOT_PATH . "public/avatar/" . $dir1 . '/' . $dir2 . '/' . $dir3, 0777);
             }
             $id = str_pad($id, 2, "0", STR_PAD_LEFT);
             $id = substr($id, -2);
             $avatar_file_big = APP_ROOT_PATH . "public/avatar/" . $path . "/" . $id . "virtual_avatar_big.jpg";
             $avatar_file_middle = APP_ROOT_PATH . "public/avatar/" . $path . "/" . $id . "virtual_avatar_middle.jpg";
             $avatar_file_small = APP_ROOT_PATH . "public/avatar/" . $path . "/" . $id . "virtual_avatar_small.jpg";
             @file_put_contents($avatar_file_big, file_get_contents($img_result['image_1']['thumb']['big']['path']));
             @file_put_contents($avatar_file_middle, file_get_contents($img_result['image_1']['thumb']['middle']['path']));
             @file_put_contents($avatar_file_small, file_get_contents($img_result['image_1']['thumb']['small']['path']));
             @unlink($img_result['image_1']['thumb']['big']['path']);
             @unlink($img_result['image_1']['thumb']['middle']['path']);
             @unlink($img_result['image_1']['thumb']['small']['path']);
             @unlink($img_result['image_1']['path']);
             //end 上传
         }
         $root['response_code'] = 1;
         $root['user_avatar'] = get_abs_img_root(get_muser_avatar($user_data['id'], "big"));
     } else {
         $root['response_code'] = 0;
         $root['show_err'] = "未登录";
         $root['user_login_status'] = 0;
     }
     output($root);
 }
开发者ID:myjavawork,项目名称:sanxin-fangwei,代码行数:68,代码来源:uc_avatar.action.php

示例12: upload_topic

/**
 * 分享点评的上传,上传到comment目录,按日期划分
 * 错误返回 error!=0,message错误消息
 * 正确时返回 error=0, url: ./public格式的文件相对路径  path:物理路径 name:文件名
 * thumb->preview 60x60的小图 url,path
 */
function upload_topic($_files)
{
    //上传处理
    //创建comment目录
    if (!is_dir(APP_ROOT_PATH . "public/comment")) {
        @mkdir(APP_ROOT_PATH . "public/comment");
        @chmod(APP_ROOT_PATH . "public/comment", 0777);
    }
    $dir = to_date(NOW_TIME, "Ym");
    if (!is_dir(APP_ROOT_PATH . "public/comment/" . $dir)) {
        @mkdir(APP_ROOT_PATH . "public/comment/" . $dir);
        @chmod(APP_ROOT_PATH . "public/comment/" . $dir, 0777);
    }
    $dir = $dir . "/" . to_date(NOW_TIME, "d");
    if (!is_dir(APP_ROOT_PATH . "public/comment/" . $dir)) {
        @mkdir(APP_ROOT_PATH . "public/comment/" . $dir);
        @chmod(APP_ROOT_PATH . "public/comment/" . $dir, 0777);
    }
    $dir = $dir . "/" . to_date(NOW_TIME, "H");
    if (!is_dir(APP_ROOT_PATH . "public/comment/" . $dir)) {
        @mkdir(APP_ROOT_PATH . "public/comment/" . $dir);
        @chmod(APP_ROOT_PATH . "public/comment/" . $dir, 0777);
    }
    if (app_conf("IS_WATER_MARK") == 1) {
        $img_result = save_image_upload($_files, "file", "comment/" . $dir, $whs = array('preview' => array(60, 60, 1, 0)), 1, 1);
    } else {
        $img_result = save_image_upload($_files, "file", "comment/" . $dir, $whs = array('preview' => array(60, 60, 1, 0)), 0, 1);
    }
    if (intval($img_result['error']) != 0) {
        return $img_result;
    } else {
        if ($GLOBALS['distribution_cfg']['OSS_TYPE'] && $GLOBALS['distribution_cfg']['OSS_TYPE'] != "NONE") {
            syn_to_remote_image_server($img_result['file']['url']);
            syn_to_remote_image_server($img_result['file']['thumb']['preview']['url']);
        }
    }
    $data_result['error'] = 0;
    $data_result['url'] = $img_result['file']['url'];
    $data_result['path'] = $img_result['file']['path'];
    $data_result['name'] = $img_result['file']['name'];
    $data_result['thumb'] = $img_result['file']['thumb'];
    require_once APP_ROOT_PATH . "system/utils/es_imagecls.php";
    $image = new es_imagecls();
    $info = $image->getImageInfo($img_result['file']['path']);
    $image_data['width'] = intval($info[0]);
    $image_data['height'] = intval($info[1]);
    $image_data['name'] = valid_str($_FILES['file']['name']);
    $image_data['filesize'] = filesize($img_result['file']['path']);
    $image_data['create_time'] = NOW_TIME;
    $image_data['user_id'] = intval($GLOBALS['user_info']['id']);
    $image_data['user_name'] = strim($GLOBALS['user_info']['user_name']);
    $image_data['path'] = $img_result['file']['thumb']['preview']['url'];
    $image_data['o_path'] = $img_result['file']['url'];
    $GLOBALS['db']->autoExecute(DB_PREFIX . "topic_image", $image_data);
    $data_result['id'] = intval($GLOBALS['db']->insert_id());
    return $data_result;
}
开发者ID:macall,项目名称:jsd,代码行数:63,代码来源:functions.php


注:本文中的save_image_upload函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。