2017-05-03 3 views
0

I'we의의 HTML 편집기에 대한 코드입니다.업로드 이미지 던져 ckeditor

if (CKEDITOR.env.ie && CKEDITOR.env.version < 9) { 
    CKEDITOR.tools.enableHtml5Elements(document); 
} 
CKEDITOR.config.height = 150; 
CKEDITOR.config.width = 'auto'; 
CKEDITOR.config.defaultLanguage = 'en'; 
CKEDITOR.config.language = 'en'; 
CKEDITOR.config.extraPlugins = 'uploadimage,filebrowser'; 
CKEDITOR.config.toolbarCanCollapse = true; 
function loadEditor(id) { 
    if (CKEDITOR.revision === ('%RE' + 'V%') || !!CKEDITOR.plugins.get('wysiwygarea')) { 
     CKEDITOR.replace(id); 
    } else { 
     CKEDITOR.document.getById(id).setAttribute('contenteditable', 'true'); 
     CKEDITOR.inline(id); 
    } 
} 
loadEditor('editor'); 

누군가 내게 간단한 이미지를 업로드 할 수있는 방법을 설명하는 간단한 설명을 제공 할 수 있습니다. 나는 그것을하기 위해 1 주일 이상 노력했다. 나는 플러그인 uploadimage를 다운로드했고, 의존성 플러그인이다. "이미지 속성"창에 "업로드"태그가 나타나지 않습니다. 고맙습니다.

답변

1

UploadImage 추가 기능은 놓거나 붙여 넣은 이미지에만 작동합니다. 당신은 단지 이미지 속성에서 탭을 업로드하려는 경우 업로드 처리하는 스크립트에 config.filebrowserImageUploadUrl를 설정해야합니다 :

config.filebrowserImageUploadUrl = '/uploader/upload.php?type=Images'; 

당신의 upload.php이 같아야을 (Integrating CKEditor with a Custom File Browser에서 예를 들어 3 촬영) :

<?php 
// Required: anonymous function reference number as explained above. 
$funcNum = $_GET['CKEditorFuncNum'] ; 
// Optional: instance name (might be used to load a specific configuration file or anything else). 
$CKEditor = $_GET['CKEditor'] ; 
// Optional: might be used to provide localized messages. 
$langCode = $_GET['langCode'] ; 

// Check the $_FILES array and save the file. Assign the correct path to a variable ($url). 
$url = '/path/to/uploaded/file.ext'; 
// Usually you will only assign something here if the file could not be uploaded. 
$message = ''; 

echo "<script type='text/javascript'>window.parent.CKEDITOR.tools.callFunction($funcNum, '$url', '$message');</script>"; 
?>