servermgrv2 init...

This commit is contained in:
최준흠git config git config --helpgit config --global user.name 최준흠 2023-08-05 22:20:24 +09:00
parent 89b2720027
commit 8b92a2090c
2 changed files with 11 additions and 13 deletions

View File

@ -181,11 +181,15 @@ define('AUTH_ADAPTERS', [
//Upload , Download 관련
define('PATHS', [
'EXCEL' => "excel/", 'UPLOAD' => "uploads/", 'DOWNLOAD' => "download/", 'API' => "api/",
'EXCEL' => WRITEPATH . "excel/",
'UPLOAD' => WRITEPATH . "uploads/",
'UPLOAD_PHOTO' => FCPATH . 'upload_images/',
'DOWNLOAD' => WRITEPATH . "download/",
'API' => WRITEPATH . "api/",
]);
foreach (PATHS as $key => $path) {
if (!is_dir(WRITEPATH . $path)) {
mkdir(WRITEPATH . $path, 0640);
if (!is_dir($path)) {
mkdir($path, 0640);
}
}

View File

@ -97,13 +97,10 @@ abstract class BaseController extends Controller
//Upload FIle관련
private function upload_file_process(UploadedFile $upfile)
{
if (!is_dir(WRITEPATH . PATHS['UPLOAD'])) {
mkdir(WRITEPATH . PATHS['UPLOAD'], 0640);
}
$fileName = null;
if ($upfile->isValid() && !$upfile->hasMoved()) {
$originName = $upfile->getName();
$upfile->move(WRITEPATH . PATHS['UPLOAD'], $upfile->getRandomName());
$upfile->move(PATHS['UPLOAD'], $upfile->getRandomName());
//move시 중복된파일명이 있다면 파일명이 바뀌므로 여기서 한번더 파일명 확인 필요
$fileName = $originName . DEFAULTS['DELIMITER_FILE'] . $upfile->getName();
}
@ -111,9 +108,6 @@ abstract class BaseController extends Controller
}
private function upload_image_process(UploadedFile $upfile, $sizeX = 100, $sizeY = 100)
{
if (!is_dir(FCPATH . '/upload_images')) {
mkdir(FCPATH . '/upload_images', 0640);
}
//참고:https://www.positronx.io/codeigniter-resize-image-with-image-manipulation-tutorial/
$fileName = null;
if ($upfile->isValid() && !$upfile->hasMoved()) {
@ -122,8 +116,8 @@ abstract class BaseController extends Controller
$image = \Config\Services::image();
$image->withFile($upfile)
->resize($sizeX, $sizeY, true, 'height')
->save(FCPATH . '/upload_images/' . $fileName);
$upfile->move(FCPATH . '/upload_images/', "original_" . $fileName);
->save(PATHS['UPLOAD_PHOTO'] . $fileName);
$upfile->move(PATHS['UPLOAD_PHOTO'], "original_" . $fileName);
$fileName = $originName . DEFAULTS['DELIMITER_FILE'] . $fileName;
}
return $fileName;
@ -575,7 +569,7 @@ abstract class BaseController extends Controller
//setting return_url to session flashdata
helper(['form']);
$this->_session->setFlashdata(SESSION_NAMES['RETURN_URL'], current_url() . '?' . $this->request->getUri()->getQuery() ?: "");
return view($this->_viewPath . '/index', ['viewDatas' => $this->_viewDatas]);
return view($this->_viewPath . '/index' . $this->request->getVar('v') ?: '', ['viewDatas' => $this->_viewDatas]);
} catch (\Exception $e) {
return alert_CommonHelper($e->getMessage(), "back");
// return redirect()->back()->with('return_message', $e->getMessage());