<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

/**
 * Editor Class
 *
 * 编辑器
 *
 * @package     zsb
 * @subpackage      Controllers
 * @category        Controllers
 * @author      sun
 */
class Pic extends MY_Controller {
    /**
    * 解析函数
    *
    * @access public
    * @return void
    */
    public function __construct()
    {
        parent::__construct();
    }
    
    public function house()
    {

        /***
        $tname = $dbback->GetOne("select truename from broker where uid = '$uid'");
		$truename = $tname != '' ? iconv('gbk','utf-8',$tname) : $_POST["truename"];

		if(!empty($truename)){
			$str1="该图片由";
			$str1=iconv('gbk','utf-8',$str1);
			$str2="提供";
			$str2=iconv('gbk','utf-8',$str2);
			$str = $str1.$truename.$str2;
			//$str = iconv('gbk','utf-8',$str);
			$this->$uf->otherstring = $str;
		}***/

        $this->load->model('pic_model');
        $filename = $this->pic_model->get_filename();
        $file = $_FILES[$filename];        //文件信息
        $filename = $file['name'];      //本地文件名
        $tmpFile = $file['tmp_name'];   //临时文件名
        $fileType = $file['type'];      //文件类型
        $this->load->model('zsb_api_model');
        $result = $this->zsb_api_model->requestFile('uploadPic',$filename,$tmpFile,$fileType );
        echo $result['pic_url'];exit;

        //判断是否上传是360全景图片
		if(!empty($_GET['uploadType']) && $_GET['uploadType'] == '1')
		{
			//360全景图片限制上传大小，默认限制 5M
			$this->pic_model->_max_size = 5120;
			$this->pic_model->_image_width = '2688';
			$this->pic_model->_image_height = '1344';
			$this->pic_model->_imageCategory = '1';
			//$this->pic_model->_resize_width = '160';
			//$this->pic_model->_resize_height = '120';
		}	

		if(isset($_COOKIE['yii_debug']) && $_COOKIE['yii_debug']){
			writeLog('enter upload');
		}

        $s =  $this->pic_model->upload();
		writeLog('gg');
		echo $s;
    }
    
    /**
     * 普通的上传
     */
    public function common()
    {   
        $this->load->model('pic_model');
        echo $this->pic_model->common_upload();
    }
}
