35 lines
1.3 KiB
PHP
35 lines
1.3 KiB
PHP
<?php
|
|
|
|
namespace App\Controllers\Mangboard;
|
|
|
|
use App\Controllers\CommonController;
|
|
use App\Libraries\MyUtil\ImageLibrary;
|
|
|
|
class ImageController extends CommonController
|
|
{
|
|
public function yamap(...$params)
|
|
{
|
|
try {
|
|
$fullPath = WRITEPATH . "uploads" . DIRECTORY_SEPARATOR . getenv('yamap.storage.upload.path');
|
|
$image = new ImageLibrary();
|
|
if (in_array("debug", $params)) {
|
|
$image->setDebug(true);
|
|
}
|
|
$image->setSourcePath($fullPath);
|
|
$image->setDestinationPath($fullPath);
|
|
foreach ($image->getFilesByExtentionType($image->getSourcePath()) as $file) {
|
|
//저장파일명
|
|
$fileInfos = pathinfo($image->getDestinationPath() . DIRECTORY_SEPARATOR . $file, PATHINFO_ALL);
|
|
$dstFile = $fileInfos['filename'] . "_small." . $fileInfos['extension'];
|
|
$image->setDestinationFile($dstFile);
|
|
$image->create($file);
|
|
}
|
|
log_message("notice", "Crawler->" . __FUNCTION__ . " 작업이 완료되었습니다.");
|
|
return "완료되었습니다.";
|
|
} catch (\Exception $e) {
|
|
log_message("error", $e->getMessage());
|
|
return $e->getMessage();
|
|
}
|
|
}
|
|
}
|