【问题标题】:How can i add domain url to the url of uploaded files when selected on ckfinder在 ckfinder 上选择时,如何将域 url 添加到上传文件的 url
【发布时间】:2019-07-29 14:36:53
【问题描述】:

我在CKEditor 4上设置ckfinder。当我选择带有“浏览服务器”按钮的图像时,图像的URL是:/ckfinder/userfiles/images/image.png

但它应该是完整的 URL,例如:http://example.com/ckfinder/userfiles/images/image.png

我的ckeditor/config.js 文件:

CKEDITOR.replace( 'content_en', {
    filebrowserBrowseUrl: 
    './assets/app/js/ckfinder/ckfinder.html',
filebrowserImageBrowseUrl: 
    './assets/app/js/ckfinder/ckfinder.html?type=Images',
filebrowserUploadUrl: 
    './assets/app/js/ckfinder/core/connector/php/connector.php?command=QuickUpload&type=Files',
filebrowserImageUploadUrl: 
    './assets/app/js/ckfinder/core/connector/php/connector.php?command=QuickUpload&type=Images'
});

ckfinder 中我的config.php 文件:

$config['backends'][] = array(
    'name'         => 'default',
    'adapter'      => 'local',
    'baseUrl'      => '/ckfinder/userfiles/',
//  'root'         => '', // Can be used to explicitly set the  CKFinder user files directory.
    'chmodFiles'   => 0777,
    'chmodFolders' => 0755,
    'filesystemEncoding' => 'UTF-8',
);

【问题讨论】:

  • 试试$_SERVER["SERVER_NAME"] . baseUrl
  • 它会创建一个新文件夹,例如“example.com/ckfinder/userfiles/”,但我想显示带有完整网址的图像
  • 天哪,我添加了 http:// 并解决了它。

标签: javascript php jquery ckeditor ckfinder


【解决方案1】:

请在backend 配置中为baseUrl 属性添加完整路径。

代替:

'baseUrl'      => '/ckfinder/userfiles/',

请使用:

'baseUrl'      => 'http://example.com//ckfinder/userfiles/',

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2018-01-08
    • 1970-01-01
    • 2014-04-25
    • 1970-01-01
    • 2011-05-12
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多