PHP强大编辑器 ckeditor_3.6.3 结合 ckfinder_php_2.2.2

1.ckeditor目录下config.js文件配置 :

CKEDITOR.editorConfig = function (config) {

    config.language = 'zh-cn';
    config.height = 500;
    config.width = 650;
    config.skin = 'office2003';
    config.font_names = '宋体/宋体;黑体/黑体;仿宋/仿宋_GB2312;楷体/楷体_GB2312;隶书/隶书;幼圆/幼圆;Arial/Arial;Comic Sans MS/Comic Sans MS;';
    config.fullPage = true;
    config.toolbar_Full = [
        ['Source', '-', 'Save', 'Preview'],
        ['Cut', 'Copy', 'Paste', 'PasteText', 'PasteFromWord', ],
        ['Undo', 'Redo', '-', 'Find', 'Replace']
            ['Bold', 'Italic', 'Underline', 'Strike', '-', 'Subscript', 'Superscript'],
        ['NumberedList', 'BulletedList', '-', 'Outdent', 'Indent', 'Blockquote'],
        ['JustifyLeft', 'JustifyCenter', 'JustifyRight', 'JustifyBlock'],
        ['Link', 'Unlink', 'Anchor'],
        '/',
        ['Styles', 'Format', 'Font', 'FontSize'],
        ['TextColor', 'BGColor'],
        ['Image', 'Flash', 'Table', 'HorizontalRule', 'Smiley', 'SpecialChar', 'PageBreak']
    ];
};


2.封装为php函数调用:

function rendEdit($id)
{
    ?>
<script type="text/javascript" src="/js/jquery-1.3.2.js"></script>
<script type="text/javascript" src="/utils/ckeditor/ckeditor_basic.js"></script>
<script type="text/javascript" src="/utils/ckeditor/ckfinder/ckfinder.js"></script>
<script type="text/javascript">
    $(document).ready(function () {
        CKEDITOR.replace('<?php echo  $id ?>',
            {
                filebrowserBrowseUrl:'/utils/ckeditor/ckfinder/ckfinder.html',
                filebrowserImageBrowseUrl:'/utils/ckeditor/ckfinder/ckfinder.html?Type=Images',
                filebrowserFlashBrowseUrl:'/utils/ckeditor/ckfinder/ckfinder.html?Type=Flash',
                filebrowserUploadUrl:'/utils/ckeditor/ckfinder/core/connector/php/connector.php?command=QuickUpload&type=Files',
                filebrowserImageUploadUrl:'/utils/ckeditor/ckfinder/core/connector/php/connector.php?command=QuickUpload&type=Images',
                filebrowserFlashUploadUrl:'/utils/ckeditor/ckfinder/core/connector/php/connector.php?command=QuickUpload&type=Flash'
            });
    });
</script>
<?php
}

 3.   ckfinder  修改上传文件保存目录      ckfinder 目录下config.js文件配置 :

$baseUrl = "/img/upload/";//修改上传文件保存的根目录

4. 修改中文名的图片上传问题  修改ckfinder\core\connector\php\php5\CommandHandler目录下的FileUpload.php文件

//在 $oRegistry->set("FileUpload_fileName", $sFileName);这行代码上面添加
 $sExtension = CKFinder_Connector_Utils_FileSystem::getExtension($sFileName);
 $sFileName = date("Ymd") . "_" . date("His") . "." . $sExtension;

//去掉生成缩略图  中文命名的文件有点小问题
//  CKFinder_Connector_CommandHandler_Thumbnail::createThumb($sFilePath, $sFilePath, $_imagesConfig->getMaxWidth(), $_imagesConfig->getMaxHeight(), $_imagesConfig->getQuality(), true);
     

 

你可能感兴趣的:(PHP,ckeditor_3.6.3)