Exemplo n.º 1
0
 public function testGeneral()
 {
     $manager = new ImageProcess();
     $filename = KENDO_STATIC_DIR . '/nophoto/event_avatar_lg.jpg';
     $image = $manager->load($filename);
     $image->destroy();
 }
Exemplo n.º 2
0
 public function excute()
 {
     // Init Data
     $data['category'] = $this->that->mcategory->findAll();
     $data['error'] = '';
     // Config path image
     $old_path_name = APPPATH . '../assets/uploads/';
     // Submit was click
     if ($this->that->input->post('name')) {
         // Init image process
         $imageProcess = new ImageProcess($this->that);
         // Init image Config
         $myConfig = new MyConfig();
         // Get data product
         $data['product'] = $this->getDataProduct();
         $imageProcess->setConfig($myConfig->getConfigUpload());
         if (!$imageProcess->getUpload()->upload(new uploadUserLib())) {
             $data['error'] = $imageProcess->getUpload()->getError();
         } else {
             // Get image that uploaded
             $image_data = $imageProcess->getUpload()->getImage();
             // Resize image
             $imageProcess->setConfig($myConfig->getConfigResize());
             $imageProcess->getResize()->resize(new resizeUserLib());
             // Rename image
             $rename = new Rename($image_data, $old_path_name, new getNameByTime());
             $rename->excute();
             // Add link image to upload
             $data['product']['image'] = 'assets/uploads/' . $rename->getNewName()->getName();
             echo $data['product']['image'];
         }
         $this->that->mproduct->insert($data['product']);
         redirect('cproduct');
     } else {
         $this->that->load->view('product/insert', $data);
     }
 }
Exemplo n.º 3
0
 } else {
     $local_path = $o_file->getPath(LOCAL_USER_FOLDER, $uid, $ymd);
 }
 # 2. nas TEMP 디렉토리 생성.
 //$nas_path = $o_file->getPath(NAS_USER_FOLDER, $uid, $ymd);
 $src_name = $unique . "." . EXT_JPG;
 $thum_name = $unique . "_thum.jpg";
 $dest_name = $unique . "_w0." . EXT_JPG;
 # 4. url path 생성
 $s_type = "image";
 $url_path = $o_file->getUrlPath(CONTENTS_URL . "/usr", $uid, $ymd);
 $url_path .= $dest_name;
 //////////////////////////////////////////////////////////////////////////////////////////////////
 $obj_data = $GLOBALS["HTTP_RAW_POST_DATA"];
 if ($obj_data != "" and $obj_data != null) {
     $o_img = new ImageProcess();
     $o_img->bitmapDataSave($obj_data, $local_path . $src_name);
     $ar_size = getImageSize($local_path . $src_name);
     $nFileSize = $o_file->getFileSpace($local_path . $src_name);
     $ret_str = sprintf("%d+%d+%d+%s+%s", $ar_size[0], $ar_size[1], $nFileSize, $orgName, $src_name);
     // remove by rainman
     //			$ret_msg = "";
     // 640x640
     $img_width = 640;
     $img_height = 640;
     $o_img->Init_Resize($local_path . $src_name, $local_path . $dest_name, $img_width, $img_height);
     /* remove by rainman
     			$ar_size = array('140x120',
     							'220x180',
     							'220x180',
     							'40x30');