0
votes

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,

1
There are so many ways a user can delete the image, not only backspace, but also delete, cut, paste, CTRL+Z and so on. You could remove the image when the post is submitted. If the image link is not present in the submitted post that means the image should be removed.Dharman

1 Answers

0
votes

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.