getUploadPath() . DIRECTORY_SEPARATOR . $this->getPath(); // $image = new ImageLibrary(); // $image->setDebug($this->getDebug()); // $image->setSourcePath($fullPath); // $image->setDestinationPath($fullPath); // //저장파일명 // $fileInfos = pathinfo($image->getDestinationPath() . DIRECTORY_SEPARATOR . $this->getOriginName(), PATHINFO_ALL); // $dstFile = $fileInfos['filename'] . "_small." . $fileInfos['extension']; // $image->setDestinationFile($dstFile); // $result = $image->create($this->getOriginName(), $width, $height); // log_message("notice", sprintf( // "%s %s번째:%s 작업 완료", // __FUNCTION__, // $this->getOriginSequence(), // $this->getPath() // )); // //정석방식 // // if ($result) { // // if ($result) { // // //작은이미지 생성후 목적지 Path와 파일명을 다시 file_path에 넣는다. URL이 되기때문에 /로 넣어야함 // // return = sprintf( // // "%s/%s", // // $entity->getPath(), // // $image->getDestinationFile() // // )); // // } else { // // //원본이미지 생성후 목적지 Path와 파일명을 다시 file_path에 넣는다. URL이 되기때문에 /로 넣어야함 // // return sprintf( // // "%s/%s", // // $entity->getPath(), // // $this->getOriginName() // // )); // // } // // } // //망보드 방식 // //mb_files에서 file_path가 망보드 게시판 파일관리에서 image로 표시되어 file_path+file_name로 설정 // //원본이미지 생성후 목적지 Path와 파일명을 다시 file_path에 넣는다. URL이 되기때문에 /로 넣어야함 // $this->_imagePath = sprintf("%s/%s", $this->getPath(), $this->getOriginName()); // return $this; // } public function create(string $file, int $width = 480, int $height = 319): bool|string { try { if (!$this->isFileType($this->getSourcePath(), $file)) { throw new \Exception("{$file} Image 형식파일이 아닙니다."); } //저장할 디렉토리 생성 $this->makeDirectory($this->getDestinationPath()); // 이미지 파일 로드 $this->load($this->getSourcePath() . DIRECTORY_SEPARATOR . $file); // 200x200으로 이미지 크기 조정 $this->resize($width, $height); // 파일 저장 $this->save($this->getDestinationPath() . DIRECTORY_SEPARATOR . $this->getDestinationFile()); // 메모리 해제 $this->destroy(); log_message("debug", sprintf( "%s %s->%s(W:%s,H:%s) 작업완료)", __FUNCTION__, $file, $this->getDestinationFile(), $width, $height )); return sprintf("%s/%s", $this->getSourcePath(), $file); } catch (\Exception $e) { log_message("warning", $e->getMessage()); return false; } } }