コード例 #1
0
ファイル: Init_parsing.php プロジェクト: akswosn/tossi
     } 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";
         }
         $c_type = $_GET['type'];
         $c_type = $cls_sec->decrypt($c_type, $real_key);
         if ($c_type == "image") {
             $c_ext = "jpg";
         }
         $upFolder = $_GET['upFolder'];
         $upFolder = str_replace(PRE_FOLDER, "", $upFolder);
コード例 #2
0
ファイル: clsBitmapSave.php プロジェクト: akswosn/tossi
 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;
     }
 }
コード例 #3
0
ファイル: clsBitmapSave.php プロジェクト: akswosn/tossi
 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;
     }
 }