简体   繁体   中英

How to add and delete image in tinymce using php from upload folder

I need a help to make TinyMCE my user`s default editor. The problem is that if a user want to provide few screenshots through the editor and wants to later remove that image the image is not removed from upload folder.

There are many answers are available over internet to add an image in an upload folder via TinyMCE from PHP. Unfortunately, no any single answer is available to explain that if that uploaded image is removed from the editor then that image also should be removed from the uploads folder. Kindly help me to solve this kind of problem without using TinyMCE paid plugin MoxieManager.

Please help,

There is no "connection" between the HTML you are editing and the content you may have previously stored on your server.

The best advice I can give you is to compare the newly submitted content to the original content to identify if any images/files were removed from the HTML and then delete those that were removed.

I would note that relying on the DEL key while editing is a very bad idea. What if the user deletes the image but then decides not to save the content? If you have already deleted that image that will break the content. Comparing the prior content to the submitted content is the safest way to identify the differences that the author wishes to actually save.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM