Tinymce编辑器图像上传插件添加完整的图像URL

Tinymce editor image upload plugin add full image URL

本文关键字:图像 添加 URL 插件 编辑器 Tinymce      更新时间:2023-09-26

我正在使用一个名为 justboil.com 的图像上传器插件用于 tinymce 编辑器。

说很棒,并上传图像以显示它们,但我希望它能够将完整的 Web URL 添加到图像的路径中,例如:

*http://www.domain.com/upload_img/img1.jpg*

而不是

*/upload_img/img1.jpg*

这是插件的配置代码

| -------------------------------------------------------------------
|
| Path to upload target folder, relative to domain name. NO TRAILING SLASH!
| Example: if an image is acessed via http://www.example.com/images/somefolder/image.jpg, you should specify here:
| 
| $config['img_path'] = '/images/somefolder';
| 
| -------------------------------------------------------------------*/

    $config['img_path'] = '/upload_img'; // Relative to domain name
    $config['upload_path'] = $_SERVER['DOCUMENT_ROOT'] . $config['img_path']; // Physical path. [Usually works fine like this]

我尝试将$_SERVER['DOCUMENT_ROOT']更改为完整域名,但如果我这样做,它不会上传图像

有什么想法吗?

在 tinymce init 中,您可以设置以下标签:

relative_urls: false,
remove_script_host: false

然后,这将启用绝对网址,其中包含TinyMCE编辑器中添加的所有项目的完整地址。