PHP ckeditor富文字編輯器 結合ckfinder實現圖片上傳功能

來源:互聯網
上載者:User

標籤:insert   range   type=file   javascrip   example   win   .com   rup   form   

一:前端頁面代碼

<script src="/www/res/ckeditor/ckeditor.js"></script><textarea id="articlecontent" ><?php echo $request[‘content‘]; ?></textarea><script type="text/javascript"> $(‘#articlecontent‘).ckeditor({ customConfig : ‘config_user.js‘ });</script>

其中上面的config_user.js是使用者自訂設定檔,內容如下:

CKEDITOR.editorConfig = function( config ) {    // The toolbar groups arrangement, optimized for two toolbar rows.    config.toolbarGroups = [        { name: ‘clipboard‘,   groups: [ ‘clipboard‘, ‘undo‘ ] },        { name: ‘editing‘,     groups: [ ‘find‘, ‘selection‘, ‘spellchecker‘ ] },        { name: ‘links‘ },        { name: ‘insert‘ },        { name: ‘forms‘ },        { name: ‘tools‘ },        { name: ‘document‘,       groups: [ ‘mode‘, ‘document‘, ‘doctools‘ ] },        { name: ‘others‘ },        { name: ‘basicstyles‘, groups: [ ‘basicstyles‘, ‘cleanup‘ ] },        { name: ‘paragraph‘,   groups: [ ‘list‘, ‘indent‘, ‘blocks‘, ‘align‘, ‘bidi‘ ] },        { name: ‘styles‘ },        { name: ‘colors‘ },        { name: ‘about‘ }    ];    // Remove some buttons provided by the standard plugins, which are    // not needed in the Standard(s) toolbar.    config.removeButtons = ‘Underline,Subscript,Superscript‘;    // Set the most common block elements.    config.format_tags = ‘p;h1;h2;h3;pre‘;    // Simplify the dialog windows.    config.removeDialogTabs = ‘image:advanced;link:advanced‘;    //自訂配置    //config.配置項 = 值    config.width = 800;    config.height = 300;    config.uiColor = "#aabbcc";    //檔案的上傳管理:載入CKfinder  注意檔案路徑為網站根目錄 使用時,注意ckfinder檔案安裝路徑    config.filebrowserBrowseUrl      = ‘/www/res/ckfinder/ckfinder.html‘;        config.filebrowserImageBrowseUrl = ‘/www/res/ckfinder/ckfinder.html?Type=Images‘;        config.filebrowserFlashBrowseUrl = ‘/www/res/ckfinder/ckfinder.html?Type=Flash‘;        config.filebrowserUploadUrl      = ‘/www/res/ckfinder/core/connector/php/connector.php?command=QuickUpload&type=Files‘;        config.filebrowserImageUploadUrl = ‘/www/res/ckfinder/core/connector/php/connector.php?command=QuickUpload&type=Images‘;        config.filebrowserFlashUploadUrl = ‘/www/res/ckfinder/core/connector/php/connector.php?command=QuickUpload&type=Flash‘;};


二:ckeditor檔案安裝,

      注意因為在ckeditor中已經自訂了設定檔,注意裡面配置的與ckfinder檔案的相對位置

三:ckfinder檔案安裝

      需要配置上傳檔案的儲存路徑,在ckfinder檔案夾下的config.php檔案中修改

 

$baseUrl = ‘http://www.example.com/www/articlesuploads/‘;

      設定檔案的儲存路徑

 

PHP ckeditor富文字編輯器 結合ckfinder實現圖片上傳功能

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.