Example #1
0
 /**
  * 上传图片
  *
  * @param
  * @return
  */
 public function swfuploadOp()
 {
     /**
      * 读取语言包
      */
     Uk86Language::uk86_read('sns_home');
     $lang = Uk86Language::uk86_getLangContent();
     $member_id = $_SESSION['member_id'];
     $class_id = intval($_POST['category_id']);
     if ($member_id <= 0 && $class_id <= 0) {
         echo json_encode(array('state' => 'false', 'message' => Uk86Language::uk86_get('sns_upload_pic_fail'), 'origin_file_name' => $_FILES["file"]["name"]));
         exit;
     }
     $model = Model();
     // 验证图片数量
     $count = $model->table('sns_albumpic')->where(array('member_id' => $member_id))->count();
     if (C('malbum_max_sum') != 0 && $count >= C('malbum_max_sum')) {
         echo json_encode(array('state' => 'false', 'message' => Uk86Language::uk86_get('sns_upload_img_max_num_error'), 'origin_file_name' => $_FILES["file"]["name"]));
         exit;
     }
     /**
      * 上传图片
      */
     $upload = new Uk86UploadFile();
     $upload_dir = ATTACH_MALBUM . DS . $member_id . DS;
     $upload->uk86_set('default_dir', $upload_dir . $upload->getSysSetPath());
     $thumb_width = '240,1024';
     $thumb_height = '2048,1024';
     $upload->uk86_set('max_size', C('image_max_filesize'));
     $upload->uk86_set('thumb_width', $thumb_width);
     $upload->uk86_set('thumb_height', $thumb_height);
     $upload->uk86_set('fprefix', $member_id);
     $upload->uk86_set('thumb_ext', '_240,_1024');
     $result = $upload->uk86_upfile('file');
     if (!$result) {
         echo json_encode(array('state' => 'false', 'message' => Uk86Language::uk86_get('sns_upload_pic_fail'), 'origin_file_name' => $_FILES["file"]["name"]));
         exit;
     }
     $img_path = $upload->getSysSetPath() . $upload->file_name;
     list($width, $height, $type, $attr) = getimagesize(BASE_UPLOAD_PATH . DS . ATTACH_MALBUM . DS . $member_id . DS . $img_path);
     $image = explode('.', $_FILES["file"]["name"]);
     if (strtoupper(CHARSET) == 'GBK') {
         $image['0'] = Uk86Language::uk86_getGBK($image['0']);
     }
     $insert = array();
     $insert['ap_name'] = $image['0'];
     $insert['ac_id'] = $class_id;
     $insert['ap_cover'] = $img_path;
     $insert['ap_size'] = intval($_FILES['file']['size']);
     $insert['ap_spec'] = $width . 'x' . $height;
     $insert['upload_time'] = time();
     $insert['member_id'] = $member_id;
     $result = $model->table('sns_albumpic')->insert($insert);
     $data = array();
     $data['file_id'] = $result;
     $data['file_name'] = $img_path;
     $data['origin_file_name'] = $_FILES["file"]["name"];
     $data['file_path'] = $img_path;
     $data['file_url'] = uk86_snsThumb($img_path, 240);
     $data['state'] = 'true';
     /**
      * 整理为json格式
      */
     $output = json_encode($data);
     echo $output;
 }
Example #2
0
        if (!empty($v['geval_image'])) {
            ?>
    <dd>
    晒单图片:
    <ul class="photos-thumb"><?php 
            $image_array = explode(',', $v['geval_image']);
            ?>
        <?php 
            foreach ($image_array as $value) {
                ?>
        <li><a nctype="nyroModal"  href="<?php 
                echo uk86_snsThumb($value, 1024);
                ?>
">
            <img src="<?php 
                echo uk86_snsThumb($value);
                ?>
">
        </a></li>
        <?php 
            }
            ?>
</ul>
    </dd>
    <?php 
        }
        ?>
  </dl>
</div>
<?php 
    }
Example #3
0
 public function add_image_saveOp()
 {
     $geval_id = intval($_POST['geval_id']);
     $geval_image = '';
     foreach ($_POST['evaluate_image'] as $value) {
         if (!empty($value)) {
             $geval_image .= $value . ',';
         }
     }
     $geval_image = rtrim($geval_image, ',');
     $model_evaluate_goods = Model('evaluate_goods');
     $geval_info = $model_evaluate_goods->getEvaluateGoodsInfoByID($geval_id);
     if (empty($geval_info)) {
         showDialog(L('param_error'));
     }
     if ($geval_info['geval_frommemberid'] != $_SESSION['member_id']) {
         showDialog(L('param_error'));
     }
     $update = array();
     $update['geval_image'] = $geval_image;
     $condition = array();
     $condition['geval_id'] = $geval_id;
     $result = $model_evaluate_goods->editEvaluateGoods($update, $condition);
     list($sns_image) = explode(',', $geval_image);
     $goods_url = uk86_urlShop('goods', 'index', array('goods_id' => $geval_info['geval_goodsid']));
     //同步到sns
     $content = "\n            <div class='fd-media'>\n            <div class='goodsimg'><a target=\"_blank\" href=\"{$goods_url}\"><img src=\"" . uk86_snsThumb($sns_image, 240) . "\" title=\"{$geval_info['geval_goodsname']}\" alt=\"{$geval_info['geval_goodsname']}\"></a></div>\n            <div class='goodsinfo'>\n            <dl>\n            <dt><a target=\"_blank\" href=\"{$goods_url}\">{$geval_info['geval_goodsname']}</a></dt>\n            <dd>价格" . Uk86Language::uk86_get('nc_colon') . Uk86Language::uk86_get('currency') . $geval_info['geval_goodsprice'] . "</dd>\n            <dd><a target=\"_blank\" href=\"{$goods_url}\">去看看</a></dd>\n            </dl>\n            </div>\n            </div>\n            ";
     $tracelog_model = Model('sns_tracelog');
     $insert_arr = array();
     $insert_arr['trace_originalid'] = '0';
     $insert_arr['trace_originalmemberid'] = '0';
     $insert_arr['trace_memberid'] = $_SESSION['member_id'];
     $insert_arr['trace_membername'] = $_SESSION['member_name'];
     $insert_arr['trace_memberavatar'] = $_SESSION['member_avatar'];
     $insert_arr['trace_title'] = '发表了商品晒单';
     $insert_arr['trace_content'] = $content;
     $insert_arr['trace_addtime'] = TIMESTAMP;
     $insert_arr['trace_state'] = '0';
     $insert_arr['trace_privacy'] = 0;
     $insert_arr['trace_commentcount'] = 0;
     $insert_arr['trace_copycount'] = 0;
     $insert_arr['trace_from'] = '1';
     $result = $tracelog_model->tracelogAdd($insert_arr);
     if ($result) {
         showDialog(L('nc_common_save_succ'), uk86_urlShop('member_evaluate', 'list'), 'succ');
     } else {
         showDialog(L('nc_common_save_succ'), uk86_urlShop('member_evaluate', 'list'));
     }
 }