I made some modifications to the attached code
Unfortunately, the code only works with small images
Large images show an error The image is converted to code and only the code appears
But the problem is, I want to show the rest of the tools
When editing, it disappears and only the image button appears
Is the code correct?
tinymce.init({
selector : 'textarea#s_description',
plugins : 'image',
toolbar : 'image',
images_upload_url : 'upload.php',
automatic_uploads : false,
images_upload_handler : function(blobInfo, success, failure) {
var xhr, formData;
xhr = new XMLHttpRequest();
xhr.withCredentials = false;
xhr.open('POST', 'upload.php');
xhr.onload = function() {
var json;
if (xhr.status != 200) {
failure('HTTP Error: ' + xhr.status);
return;
}
json = JSON.parse(xhr.responseText);
if (!json || typeof json.file_path != 'string') {
failure('Invalid JSON: ' + xhr.responseText);
return;
}
success(json.file_path);
};
formData = new FormData();
formData.append('file', blobInfo.blob(), blobInfo.filename());
xhr.send(formData);
},
});