diff --git a/public_html/lib/update_cancelcustomer.php b/public_html/lib/update_cancelcustomer.php index 3d8444b..cbc47cd 100644 --- a/public_html/lib/update_cancelcustomer.php +++ b/public_html/lib/update_cancelcustomer.php @@ -1,5 +1,5 @@ diff --git a/public_html/lib/update_column.php b/public_html/lib/update_column.php index f22da5c..056fcce 100644 --- a/public_html/lib/update_column.php +++ b/public_html/lib/update_column.php @@ -1,5 +1,5 @@ diff --git a/public_html/lib/update_customer.php b/public_html/lib/update_customer.php index 865ac1a..6cc517d 100644 --- a/public_html/lib/update_customer.php +++ b/public_html/lib/update_customer.php @@ -1,5 +1,5 @@ checkLevelModal(1); -/* -$fpath = getenv("DOCUMENT_ROOT").'/upload'; -$ffilemode = "0755"; -chmod_R($fpath, 0755); - -function chmod_R($path, $filemode) { - if (!is_dir($path)) - return chmod($path, $filemode); - - $dh = opendir($path); - while (($file = readdir($dh)) !== false) { - if($file != '.' && $file != '..' && $file != 'index.html') { - $fullpath = $path.'/'.$file; - echo "[$fullpath]
"; - if(is_link($fullpath)) - return FALSE; - elseif(!is_dir($fullpath)) - if (!chmod($fullpath, $filemode)) - return FALSE; - elseif(!chmod_R($fullpath, $filemode)) - return FALSE; - } - } - - closedir($dh); - - if(chmod($path, $filemode)) - return TRUE; - else - return FALSE; -} -exit; -*/ - -/* -$uploaddir = getenv("DOCUMENT_ROOT").'/upload/20120402132706.multi_upload _Status_20120402.csv'; -$rt = chmod ($uploaddir, 0755); - -$uploaddir = getenv("DOCUMENT_ROOT").'/upload/20120402171526.multi_upload _Status_OOI_20120402_2.csv'; -$rt = chmod ($uploaddir, 0755); - -exit; -*/ @@ -89,23 +46,6 @@ if ($mode == "insert") { $lineCnt++; -/* - // DB에 존재하는 제품인지 확인 - $query = "SELECT COUNT(c_uid) FROM tbl_customer WHERE c_accountno = '".trim($getCSV[14])."' "; - $rowCnt = $jdb->rQuery($query, "record query error"); - - if ($rowCnt == 1) { - echo "Line $lineCnt [".trim($getCSV[14])."] : Same Account No [row:$rowCnt]
"; - $runFlag = 0; - } - - if (!is_numeric(trim($getCSV[8])) && strtoupper(trim($getCSV[8])) != "FREE") { - //echo "Line $lineCnt Account No [".trim($getCSV[14])."] Rate = [".trim($getCSV[8])."] : Rate is not digit [row:$rowCnt]
"; - echo "Account No [".trim($getCSV[14])."] Rate = [".trim($getCSV[8])."]
"; - $runFlag = 0; - } -*/ - //$runFlag = 0; // $runFlag != 0 인 경우에만 DB에 저장 @@ -211,14 +151,6 @@ if ($mode == "insert") { if (trim($getCSV[26]) == "") $c_schedule = "None"; $values[] = $c_schedule; //$c_schedule - /* - if(isset($_POST["c_scheduleday"])){ - $c_scheduleday_vals =""; - foreach($_POST["c_scheduleday"] as $key => $text_field){ - $c_scheduleday_vals .= $text_field ."|"; - } - } - */ $values[] = trim($getCSV[27]); // $c_scheduleday_vals; //$values[] = $c_schedulebasic; @@ -341,5 +273,5 @@ echo " --------------------------------------------------------------

"; } // End of Modify Inventory status - + */ ?> diff --git a/public_html/lib/update_cycle.php b/public_html/lib/update_cycle.php index fca730b..4559081 100644 --- a/public_html/lib/update_cycle.php +++ b/public_html/lib/update_cycle.php @@ -1,5 +1,5 @@ diff --git a/public_html/lib/update_oilhistory.php b/public_html/lib/update_oilhistory.php index 02a7661..c6b9cf7 100644 --- a/public_html/lib/update_oilhistory.php +++ b/public_html/lib/update_oilhistory.php @@ -1,5 +1,5 @@ checkLevelModal(1); -/* -$fpath = getenv("DOCUMENT_ROOT").'/upload'; -$ffilemode = "0755"; -chmod_R($fpath, 0755); - -function chmod_R($path, $filemode) { - if (!is_dir($path)) - return chmod($path, $filemode); - - $dh = opendir($path); - while (($file = readdir($dh)) !== false) { - if($file != '.' && $file != '..' && $file != 'index.html') { - $fullpath = $path.'/'.$file; - echo "[$fullpath]
"; - if(is_link($fullpath)) - return FALSE; - elseif(!is_dir($fullpath)) - if (!chmod($fullpath, $filemode)) - return FALSE; - elseif(!chmod_R($fullpath, $filemode)) - return FALSE; - } - } - - closedir($dh); - - if(chmod($path, $filemode)) - return TRUE; - else - return FALSE; -} -exit; -*/ - -/* -$uploaddir = getenv("DOCUMENT_ROOT").'/upload/20120402132706.multi_upload _Status_20120402.csv'; -$rt = chmod ($uploaddir, 0755); - -$uploaddir = getenv("DOCUMENT_ROOT").'/upload/20120402171526.multi_upload _Status_OOI_20120402_2.csv'; -$rt = chmod ($uploaddir, 0755); - -exit; -*/ @@ -264,5 +221,5 @@ if ($lineCnt >= 2) { } // End of Modify Inventory status - + */ ?> diff --git a/public_html/lib/update_patch.php b/public_html/lib/update_patch.php new file mode 100644 index 0000000..8d4be27 --- /dev/null +++ b/public_html/lib/update_patch.php @@ -0,0 +1,93 @@ + $maxWidth) { + $newW = $maxWidth; + $newH = intval(($h / $w) * $newW); + } else { + $newW = $w; + $newH = $h; + } + + $tmp = imagecreatetruecolor($newW, $newH); + + // PNG / WEBP 투명 처리 + if ($type == IMAGETYPE_PNG || $type == IMAGETYPE_WEBP) { + imagealphablending($tmp, false); + imagesavealpha($tmp, true); + $transparent = imagecolorallocatealpha($tmp, 0, 0, 0, 127); + imagefilledrectangle($tmp, 0, 0, $newW, $newH, $transparent); + } + + imagecopyresampled($tmp, $img, 0, 0, 0, 0, $newW, $newH, $w, $h); + + $result = imagejpeg($tmp, $dest, $quality); + + imagedestroy($img); + imagedestroy($tmp); + + return $result; +} + +// 전체 파일 순회 +$rii = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($baseDir)); + +foreach ($rii as $file) { + if ($file->isDir()) continue; + + $path = $file->getPathname(); + + // 너무 작은 파일 skip + if (filesize($path) < 500000) continue; + + $info = pathinfo($path); + + // 이미 jpg면 덮어쓰기 방식 + if (strtolower($info['extension']) === 'jpg' || strtolower($info['extension']) === 'jpeg') { + echo "Compressing JPG: $path\n"; + compress($path, $path); + continue; + } + + // 확장자 변경 + $newPath = $info['dirname'] . '/' . $info['filename'] . '.jpg'; + + echo "Converting: $path -> $newPath\n"; + + if (compress($path, $newPath)) { + // 원본 삭제 + unlink($path); + } else { + echo "FAILED: $path\n"; + } +} + +echo "DONE\n"; \ No newline at end of file