Php Summernote编辑器-上载后无法查看图像
从我的文件夹上载后,无法在summer便笺中查看上载的图像Php Summernote编辑器-上载后无法查看图像,php,ajax,summernote,Php,Ajax,Summernote,从我的文件夹上载后,无法在summer便笺中查看上载的图像 <script> $('#summernote').summernote({ height: ($(window).height() - 300), callbacks: { onImageUpload: function(image) { uploadImage(image[0]); }
<script>
$('#summernote').summernote({
height: ($(window).height() - 300),
callbacks: {
onImageUpload: function(image) {
uploadImage(image[0]);
}
}
});
function uploadImage(image) {
var data = new FormData();
data.append("image", image);
$.ajax({
url: 'Your url to deal with your image',
cache: false,
contentType: false,
processData: false,
data: data,
type: "post",
success: function(url) {
var image = $('<img>').attr('src', 'http://' + url);
$('#summernote').summernote("insertNode", image[0]);
},
error: function(data) {
console.log(data);
}
});
}
</script>
$('#summernote')。summernote({
高度:($(窗口).height()-300),
回调:{
onImageUpload:函数(图像){
上传图像(图像[0]);
}
}
});
函数上传图像(图像){
var data=new FormData();
数据。追加(“图像”,图像);
$.ajax({
url:“处理图像的url”,
cache:false,
contentType:false,
processData:false,
数据:数据,
类型:“post”,
成功:函数(url){
var image=$('
这是我在索引页的脚本。请帮助我
url: 'Your url to deal with your image',
在上面的一行中,您必须写入处理文件上载并返回(回显)其url的.php文件的名称
例如:
url: 'upload.php',
当然,您必须实际创建一个正确的upload.php