在codeigniter php中使用ckeditor中的浏览选项获取错误

时间:2017-09-07 11:15:58

标签: javascript php codeigniter

要显示上传图片的浏览选项,请在ckeditor "imagebrowser"中添加一个额外的插件。单击浏览服务器选项获取错误:

HTTP Status: 404/Not Found: "/path/to/images_list.json"

关注this tutorial以实现浏览器选项获取错误。

在config.js文件中添加了此代码以启用插件。

config.extraPlugins = "imagebrowser";
config.imageBrowser_listUrl = "/path/to/images_list.json";

images_list.json:

{
{
    "image": "/image1_200x150.jpg",
    "thumb": "/image1_thumb.jpg",
    "folder": "Small"
},
{
    "image": "/image2_200x150.jpg",
    "thumb": "/image2_thumb.jpg",
    "folder": "Small"
},

{
    "image": "/image1_full.jpg",
    "thumb": "/image1_thumb.jpg",
    "folder": "Large"
},
{
    "image": "/image2_full.jpg",
    "thumb": "/image2_thumb.jpg",
    "folder": "Large"
}
}

在admin / ckeditor / plugins / imagebrowser / images_list.json中创建此文件(images_list.json)

2 个答案:

答案 0 :(得分:1)

通过在项目文件夹中添加kcfinder解决了这个问题。

Ex:htdocs / project / kcfinder

我们可以从这里下载https://sourceforge.net/projects/kcfinder/files/KCFinder/2.51/

要在ckeditor中集成kcfinder,需要在ckeditor / config.js中添加这些行

config.filebrowserBrowseUrl = '/kcfinder/browse.php?opener=ckeditor&type=files';
config.filebrowserImageBrowseUrl = '/kcfinder/browse.php?opener=ckeditor&type=images';
config.filebrowserFlashBrowseUrl = '/kcfinder/browse.php?opener=ckeditor&type=flash';
config.filebrowserUploadUrl = '/kcfinder/upload.php?opener=ckeditor&type=files';
config.filebrowserImageUploadUrl = '/kcfinder/upload.php?opener=ckeditor&type=images';
config.filebrowserFlashUploadUrl = '/kcfinder/upload.php?opener=ckeditor&type=flash';

要获得上传文件的权限需要更改kcfinder / config.php中的权限更改这些行

$_CONFIG = array(
'disabled' => false,
'denyZipDownload' => false,
'denyUpdateCheck' => false,
'denyExtensionRename' => false,

它对我有用。

答案 1 :(得分:0)

要添加数组json,请使用[],你的json文件必须如下:

[
{
    "image": "/image1_200x150.jpg",
    "thumb": "/image1_thumb.jpg",
    "folder": "Small"
},
{
    "image": "/image2_200x150.jpg",
    "thumb": "/image2_thumb.jpg",
    "folder": "Small"
},

{
    "image": "/image1_full.jpg",
    "thumb": "/image1_thumb.jpg",
    "folder": "Large"
},
{
    "image": "/image2_full.jpg",
    "thumb": "/image2_thumb.jpg",
    "folder": "Large"
}
]

将外部{}更改为[]