CHEditor에서 이미지 업로드시 get_editor_upload_url Hook에 파일의 정보 추가

`get_editor_upload_url` Hook의 세번째 인자에 파일의 추가 정보를 전달.
smarteditor2에서 정의한 것과 동일한 유형으로 데이터를 담음.
This commit is contained in:
kkigomi
2023-06-30 22:18:30 +09:00
parent af64737b63
commit 8ec09b0059

View File

@ -126,7 +126,22 @@ try {
$file_url = SAVE_URL . '/' . $filename;
if (function_exists('run_replace')) {
$file_url = run_replace('get_editor_upload_url', $file_url, $savefile, array());
$fileInfo = new \stdClass();
$fileInfo->name = (string) $filename;
$fileInfo->size = (int) $filesize;
$fileInfo->url = (string) $file_url;
if (isset($_POST['origname'])) {
$fileInfo->oriname = (string) $_POST['origname'];
}
if ($imgsize) {
$fileInfo->width = (int) $imgsize[0];
$fileInfo->height = (int) $imgsize[1];
$fileInfo->type = (string) $imgsize['mime'];
}
$file_url = run_replace('get_editor_upload_url', $file_url, $savefile, $fileInfo);
}
$rdata = sprintf(