예제 #1
0
 private function getpic($input)
 {
     $savePath = "./Data/upload/thumb/";
     $fileFormat = array('gif', 'jpg', 'jpeg', 'png', 'bmp');
     $maxSize = 0;
     $overwrite = 0;
     $thumb = 1;
     $thumbWidth = 200;
     $thumbHeight = 200;
     import('@.ORG.clsUpload');
     $picmodel = new clsUpload($savePath, $fileFormat, $maxSize, $overwrite);
     $picmodel->setThumb($thumb, $thumbWidth, $thumbHeight);
     if (!$picmodel->run($input, 1)) {
         echo $picmodel->errmsg() . "<br>\n";
     }
     $pic = $picmodel->getInfo();
     return "/Data/upload/thumb/" . $pic[0]["saveName"];
 }
예제 #2
0
 public function ThumImg($path, $c_uid)
 {
     $destPath = $path . ".jpg";
     $cls_up = new clsUpload();
     $cls_up->MakeThum($path, $destPath, ".jpg");
     $cls_config = new clsConfig();
     $c_host = $cls_config->GetRealServerIp();
     $c_url = $cls_config->GetRealServerPage();
     $c_url .= "image" . "&id={$c_uid}" . "&rurl=" . $cls_config->GetReturnUrl();
     $arrData = split("id=testfile&", $c_url);
     $c_url = $arrData[0] . $arrData[1];
     $cls_MultiUp = new clsMultiUp();
     $result = $cls_MultiUp->MultiPartUpload($c_host, $c_url, $destPath);
     // 썸네일 이미지.
     $this->thum_path = $result;
     //unlink($destPath);
     #echo $result;
 }
예제 #3
0
 public function BitmapData2Jpg($lowdata, $path)
 {
     //$data = $GLOBALS["HTTP_RAW_POST_DATA"];
     if (is_null($lowdata)) {
         echo "No data was sent";
     } else {
         $file = fopen($path, "w") or die("Can't open file");
         if (!fwrite($file, $lowdata)) {
             echo "Error writing to file";
         }
         fclose($file);
         chmod($filename, 0777);
         $cls_config = new clsConfig();
         $url_path = trim($cls_config->GetURL($path));
         list($width, $height) = getImageSize($path);
         #$filesize = filesize($path);
         // org
         # filename
         $pos = strrpos($url_path, "/") + 1;
         $file_name = substr($url_path, $pos);
         $ret_str = sprintf("aaa&msg=%d+%d+%s", $width, $height, $file_name);
         // 140x120
         $img_width = 640;
         $img_height = 640;
         $src_ext = ".jpg";
         $out_ext = ".jpg";
         $pos = stripos($path, $src_ext);
         $destPath = substr($path, 0, $pos) . "_w0" . $out_ext;
         $clsResize = new clsUpload();
         $clsResize->ImageResize_Ex($path, $destPath, $img_width, $img_height, $out_ext);
         // 140x120
         $img_width = 140;
         $img_height = 120;
         $src_ext = ".jpg";
         $out_ext = ".png";
         $pos = stripos($path, $src_ext);
         $destPath = substr($path, 0, $pos) . "_w1" . $out_ext;
         $clsResize->ImageResize($path, $destPath, $img_width, $img_height, $out_ext);
         #$url_path = trim($cls_config->GetURL($destPath));
         # 220 x 180
         $img_width = 220;
         $img_height = 180;
         $src_ext = ".jpg";
         $out_ext = ".png";
         $pos = stripos($path, $src_ext);
         $destPath = substr($path, 0, $pos) . "_w2" . $out_ext;
         $clsResize->ImageResize($path, $destPath, $img_width, $img_height, $out_ext);
         #$url_path = trim($cls_config->GetURL($destPath));
         # 300 x 240
         $img_width = 300;
         $img_height = 240;
         $src_ext = ".jpg";
         $out_ext = ".png";
         $pos = stripos($path, $src_ext);
         $destPath = substr($path, 0, $pos) . "_w3" . $out_ext;
         $clsResize->ImageResize($path, $destPath, $img_width, $img_height, $out_ext);
         #$url_path = trim($cls_config->GetURL($destPath));
         //echo $ret_str;
         return $ret_str;
     }
 }
예제 #4
0
     // $c_filename == "" : 유니크한 파일명 생성
     // $c_filename != "" : 해당 파일명 생성
     // $c_name = c_filename.jpg
     $c_name = $cls_folder->GetFileName($c_filename, $c_ext);
     if ($c_filename != "") {
         $c_ext = ".jpg";
         $srcpath = $c_folder . $c_name;
         // . ".".$c_ext;// . $ext;
     } else {
         $c_ext = ".jpg";
         $srcpath = $c_folder . $c_name;
         // . $ext;
     }
     $destpath = $c_folder . $c_name;
     if ($_FILES['Filedata']['name']) {
         $cls_upload = new clsUpload();
         $cls_upload->FileUpload($_FILES['Filedata']['tmp_name'], $srcpath, $destpath, $c_ext, $c_type);
     } else {
         echo "error :", $destpath;
     }
     $cls_config = new clsConfig();
     // 로컬 path -> url 경로로..
     // $destURL = "http://app.na4.com/usr/20070101/img.png"
     $destURL = $cls_config->GetURL($destpath);
     echo $destURL, $destpath;
     // 6. flash에서 이미지(low data)를 받아서 서버에 저장
 } else {
     if ($method == "saveup") {
         $c_uid = $_GET['uid'];
         if ($c_uid == "null") {
             $c_uid = "a0000145";
예제 #5
0
 public function BitmapData2Jpg($lowdata, $path)
 {
     //$data = $GLOBALS["HTTP_RAW_POST_DATA"];
     if (is_null($lowdata)) {
         echo "No data was sent";
     } else {
         $file = fopen($path, "w") or die("Can't open file");
         if (!fwrite($file, $lowdata)) {
             echo "Error writing to file";
         }
         fclose($file);
         $cls_config = new clsConfig();
         $url_path = trim($cls_config->GetURL($path));
         list($width, $height) = getImageSize($path);
         #$filesize = filesize($path);
         // org
         # filename
         $pos = strrpos($url_path, "/") + 1;
         $file_name = substr($url_path, $pos);
         // 640x480
         $img_width = 640;
         $img_height = 640;
         $src_ext = ".jpg";
         $out_ext = ".jpg";
         $pos = stripos($path, $src_ext);
         $file_path = substr($path, 0, $pos);
         $destPath = $file_path . $out_ext;
         $clsResize = new clsUpload();
         $clsResize->ImageResize_Ex($path, $destPath, $img_width, $img_height, $out_ext);
         chmod($destPath, 0755);
         list($width, $height) = getImageSize($destPath);
         $ret_str = sprintf("aaa&msg=%d+%d+%s", $width, $height, $file_name);
         // tossi customization
         //
         $image_info = getimagesize($destPath);
         // get source image width/height
         //
         $sw = $image_info[0];
         $sh = $image_info[1];
         // 40x30 (Thumbnail image for wap)
         $dw = 40;
         $dh = 30;
         $destPath = $file_path . "_w4.png";
         $cmd = " -resize '{$dw}x{$dh}!' -type Palette -depth 8 {$destPath}";
         // 176x240
         $dw = $sw;
         $dh = $sh;
         $this->calc_resize($dw, $dh, 140, 120, true);
         $destPath = $file_path . "_w1.png";
         $cmd = " -resize {$dw}x{$dh} -type Palette -depth 8 -write {$destPath}" . $cmd;
         // 240x320
         $dw = $sw;
         $dh = $sh;
         $this->calc_resize($dw, $dh, 220, 180, true);
         $destPath = $file_path . "_w2.png";
         $cmd = " -resize {$dw}x{$dh} -type Palette -depth 8 -write {$destPath}" . $cmd;
         // 320x240
         $dw = $sw;
         $dh = $sh;
         $this->calc_resize($dw, $dh, 220, 180, true);
         $destPath = $file_path . "_w3.png";
         $cmd = " -resize {$dw}x{$dh} -type Palette -depth 8 -write {$destPath}" . $cmd;
         $cmd_path = "convert";
         if (file_exists("/usr/local/bin/convert")) {
             $cmd_path = "/usr/local/bin/convert";
         } else {
             if (file_exists("/usr/bin/convert")) {
                 $cmd_path = "/usr/bin/convert";
             }
         }
         $cmd = "{$cmd_path} {$path} " . $cmd;
         $cmd_out = array();
         $ret_val = 0;
         $ret = exec($cmd, $cmd_out, $ret_val);
         chmod(substr($path, 0, $pos) . "_w1.png", 0755);
         chmod(substr($path, 0, $pos) . "_w2.png", 0755);
         chmod(substr($path, 0, $pos) . "_w3.png", 0755);
         chmod(substr($path, 0, $pos) . "_w4.png", 0755);
         // test for $ret_val
         /*
         			// 140x120
         			$img_width = 140;
         			$img_height = 120;
         			$src_ext = ".jpg";			
         			$out_ext = ".png";
         			$pos = stripos($path, $src_ext);
         			$destPath  = substr($path, 0, $pos)."_w1".$out_ext;
         			
         			$clsResize->ImageResize($path, $destPath, $img_width, $img_height, $out_ext );
         			
         			#$url_path = trim($cls_config->GetURL($destPath));			
         			
         			# 220 x 180
         			$img_width = 220;
         			$img_height = 180;
         			$src_ext = ".jpg";			
         			$out_ext = ".png";
         			$pos = stripos($path, $src_ext);
         			$destPath  = substr($path, 0, $pos)."_w2".$out_ext;
         			
         			$clsResize->ImageResize($path, $destPath, $img_width, $img_height, $out_ext );
         			
         			#$url_path = trim($cls_config->GetURL($destPath));			
         			
         			# 300 x 240
         			$img_width = 300;
         			$img_height = 240;
         			
         			$src_ext = ".jpg";			
         			$out_ext = ".png";
         			$pos = stripos($path, $src_ext);
         			$destPath  = substr($path, 0, $pos)."_w3".$out_ext;
         			
         			$clsResize->ImageResize($path, $destPath, $img_width, $img_height, $out_ext );
         			
         			#$url_path = trim($cls_config->GetURL($destPath));			
         
         			//echo $ret_str;
         */
         return $ret_str;
     }
 }