0

i am using a web bases rich text editor on my site to allow users to edit and format text.

When we add a picture, the text editor uploads the image file to the images directory on server and displays back through a URL from server.

But some people may delete a uploaded image and upload another few.

But that deleted image from rich text editor, is still on server.

Then pver time the server will fill with unwanted files. How can i can remove such like files?

Im working with php, on this task. give me some hints.

4

1 回答 1

0

让我们将带有编辑文本的实体称为 a post。Apost有一个称为数组类型的字段image_urls(如果您的数据库不支持它,您可以将其序列化为数组)。

最新帖子

对于新帖子,image_urls列表为空。当用户在编辑过程中上传图像时,url 会image_urls作为一个集合存储。用户保存帖子后,一个函数会检查img帖子正文中的标签,创建另一个名为final_image_urls. final_image_urlsset 和set之间的差异image_urls被删除。

现有职位

编辑现有帖子就像新帖子一样,除了起始image_urls字段不为空。

支持修订

当像 SO 那样支持后期修订时,这会变得复杂。

于 2015-06-08T12:14:15.150 回答