Skip to content

Commit

Permalink
CHEditor에서 이미지 업로드시 get_editor_upload_url Hook에 파일의 정보 추가
Browse files Browse the repository at this point in the history
`get_editor_upload_url` Hook의 세번째 인자에 파일의 추가 정보를 전달.
smarteditor2에서 정의한 것과 동일한 유형으로 데이터를 담음.
  • Loading branch information
kkigomi committed Jun 30, 2023
1 parent af64737 commit 8ec09b0
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion plugin/editor/cheditor5/imageUpload/upload.php
Expand Up @@ -126,7 +126,22 @@ function che_reprocessImage($file_path, $callback)
$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(
Expand Down

0 comments on commit 8ec09b0

Please sign in to comment.