예제 #1
1
 /**
  * 图片裁剪
  *
  */
 public function pic_cutOp()
 {
     Uk86Language::uk86_read('admin_common');
     $lang = Uk86Language::uk86_getLangContent();
     uk86_import('function.thumb');
     if (uk86_chksubmit()) {
         $thumb_width = $_POST['x'];
         $x1 = $_POST["x1"];
         $y1 = $_POST["y1"];
         $x2 = $_POST["x2"];
         $y2 = $_POST["y2"];
         $w = $_POST["w"];
         $h = $_POST["h"];
         $scale = $thumb_width / $w;
         $src = str_ireplace(UPLOAD_SITE_URL, BASE_UPLOAD_PATH, $_POST['url']);
         if (strpos($src, '..') !== false || strpos($src, BASE_UPLOAD_PATH) !== 0) {
             exit;
         }
         if (!empty($_POST['filename'])) {
             // 				$save_file2 = BASE_UPLOAD_PATH.'/'.$_POST['filename'];
             $save_file2 = str_ireplace(UPLOAD_SITE_URL, BASE_UPLOAD_PATH, $_POST['filename']);
         } else {
             $save_file2 = str_replace('_small.', '_sm.', $src);
         }
         $cropped = uk86_resize_thumb($save_file2, $src, $w, $h, $x1, $y1, $scale);
         @unlink($src);
         $pathinfo = pathinfo($save_file2);
         exit($pathinfo['basename']);
     }
     $save_file = str_ireplace(UPLOAD_SITE_URL, BASE_UPLOAD_PATH, $_GET['url']);
     $_GET['resize'] = $_GET['resize'] == '0' ? '0' : '1';
     Tpl::output('height', uk86_get_height($save_file));
     Tpl::output('width', uk86_get_width($save_file));
     Tpl::showpage('common.pic_cut', 'null_layout');
 }
예제 #2
0
 /**
  * 上传图片
  */
 public function uploadOp()
 {
     if (!uk86_chksubmit()) {
         uk86_redirect('index.php?act=wap_member_setting&op=change_avatar');
     }
     uk86_import('function.thumb');
     $member_id = $_SESSION['member_id'];
     //上传图片
     $upload = new Uk86UploadFile();
     $upload->uk86_set('thumb_width', 500);
     $upload->uk86_set('thumb_height', 499);
     $ext = strtolower(pathinfo($_FILES['pic']['name'], PATHINFO_EXTENSION));
     $upload->uk86_set('file_name', "avatar_{$member_id}.{$ext}");
     $upload->uk86_set('thumb_ext', '_new');
     $upload->uk86_set('ifremove', true);
     $upload->uk86_set('default_dir', ATTACH_AVATAR);
     if (!empty($_FILES['pic']['tmp_name'])) {
         $result = $upload->uk86_upfile('pic');
         if (!$result) {
             $this->wap_showDialog($upload->error);
         }
     } else {
         $this->wap_showDialog('上传失败,请尝试更换图片格式或小图片');
     }
     Tpl::output('menu_sign', 'profile');
     Tpl::output('menu_sign_url', 'index.php?act=member_information&op=member');
     Tpl::output('menu_sign1', 'avatar');
     Tpl::output('newfile', $upload->thumb_image);
     Tpl::output('height', uk86_get_height(BASE_UPLOAD_PATH . '/' . ATTACH_AVATAR . '/' . $upload->thumb_image));
     Tpl::output('width', uk86_get_width(BASE_UPLOAD_PATH . '/' . ATTACH_AVATAR . '/' . $upload->thumb_image));
     Tpl::showpage('setting.account_avatar');
 }
예제 #3
0
 public function uploadOp()
 {
     if (!uk86_chksubmit()) {
         uk86_redirect('index.php?act=member_information&op=avatar');
     }
     uk86_import('function.thumb');
     Uk86Language::uk86_read('member_home_member,cut');
     $lang = Uk86Language::uk86_getLangContent();
     $member_id = $_SESSION['member_id'];
     //上传图片
     $upload = new Uk86UploadFile();
     $upload->uk86_set('thumb_width', 500);
     $upload->uk86_set('thumb_height', 499);
     $ext = strtolower(pathinfo($_FILES['pic']['name'], PATHINFO_EXTENSION));
     $upload->uk86_set('file_name', "avatar_{$member_id}.{$ext}");
     $upload->uk86_set('thumb_ext', '_new');
     $upload->uk86_set('ifremove', true);
     $upload->uk86_set('default_dir', ATTACH_AVATAR);
     if (!empty($_FILES['pic']['tmp_name'])) {
         $result = $upload->uk86_upfile('pic');
         if (!$result) {
             uk86_showMessage($upload->error, '', 'html', 'error');
         }
     } else {
         uk86_showMessage('上传失败,请尝试更换图片格式或小图片', '', 'html', 'error');
     }
     self::profile_menu('member', 'avatar');
     Tpl::output('menu_sign', 'profile');
     Tpl::output('menu_sign_url', 'index.php?act=member_information&op=member');
     Tpl::output('menu_sign1', 'avatar');
     Tpl::output('newfile', $upload->thumb_image);
     Tpl::output('height', uk86_get_height(BASE_UPLOAD_PATH . '/' . ATTACH_AVATAR . '/' . $upload->thumb_image));
     Tpl::output('width', uk86_get_width(BASE_UPLOAD_PATH . '/' . ATTACH_AVATAR . '/' . $upload->thumb_image));
     Tpl::showpage('member_profile.avatar');
 }