我正在使用TinyMCE Laravel文件管理器,但每当我添加图像时我都会遇到问题。我保存的照片保存在public_html / photos,但是当我使用Insert>将图像添加到tinyMCE编辑器时图片。编辑器显示损坏的图像,因为提供的src具有laravel-filemanager的前缀,显示为
src="http://localhost:8000/laravel-filemanager/photos/user_icon_add.png"
而不是
src="http://localhost:8000/photos/user_icon_add.png"
如何删除我添加的照片的laravel-filemanager前缀?
以下是我的lfm.php的一些配置
'url_prefix' => 'laravel-filemanager',
'base_directory' => 'public_html',
'images_folder_name' => 'photos',
'files_folder_name' => 'files',
'shared_folder_name' => 'shares',
'thumb_folder_name' => 'thumbs',
这是我的tinyMCE js config
var editor_config = {
path_absolute: "{{ URL::to('/') }}/",
selector: "textarea",
plugins: ["advlist autolink lists link charmap print preview hr pagebreak", "searchreplace wordcount visualblocks visualchars code fullscreen", "insertdatetime nonbreaking save table contextmenu directionality", "emoticons paste textcolor colorpicker textpattern"],
toolbar: "insertfile undo redo | styleselect | bold italic | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | link",
style_formats:
[
{
title: 'Bullet',
selector: 'ul',
classes: 'browser-default',
}
],
relative_urls: false,
file_browser_callback: function (field_name, url, type, win) {
var x = window.innerWidth || document.documentElement.clientWidth || document.getElementByTagName('body')[0].clientWidth;
var y = window.innerHeight || document.documentElement.clientHeight || document.grtElementByTagName('body')[0].clientHeight;
var cmsURL = editor_config.path_absolute + 'laravel-filemanager?field_name' + field_name;
if (type = 'image') {
cmsURL = cmsURL + '&type=Images';
} else {
cmsUrl = cmsURL + '&type=Files';
}
tinyMCE.activeEditor.windowManager.open({
file: cmsURL,
title: 'Filemanager',
width: x * 0.8,
height: y * 0.8,
resizeble: 'yes',
close_previous: 'no'
});
}
};
tinymce.init(editor_config);
答案 0 :(得分:0)
.env中的app_url可能不正确。 在.env文件中设置您的APP_URL