2017-05-03 5 views
0

I'we HTML-Code für die Redaktion:Hochladen von Bildwurf ckeditor

<div id="editor"> 
    <h1>Hello world!</h1> 
    <p>I'm an instance of <a href="http://ckeditor.com">CKEditor</a>.</p> 
</div> 

und Javascript für sie.

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'); 

Kann jemand mir eine einfache Erklärung geben, wie man macht, dass ich Bild geraden Wurf ckeditor hochladen kann. Ich habe über eine Woche versucht, es zu tun. Ich habe Plugins uploadimage heruntergeladen, und es ist Abhängigkeiten Plugins. Kein "Upload" -Tag erscheint im "Image Properties" -Fenster. Vielen Dank

Antwort

1

UploadImage Add-on funktioniert nur für gelöschte oder eingefügte Bilder. Wenn Sie nur Registerkarte in den Bildeigenschaften hochladen möchten, müssen Sie config.filebrowserImageUploadUrl an ein Skript setzen, die den Upload behandelt:

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

Ihre upload.php sollte wie folgt sein (aus Integrating CKEditor with a Custom File Browser, Beispiel 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>"; 
?> 
Verwandte Themen