This project is read-only.

Handling Attachments

LiteBlog has some special ways to handle attachments. Unlike Wordpress, where media is stored in a separate media library, which has to be explicitly deleted from the media library, LiteBlog stores documents as attachments to a post (more like attachments to an email). LiteBlog stores documents in the "Docs" folder.


Reusing documents across posts

What is the blog author wants to reuse attachments across posts? That is not possible within LiteBlog. Here is the scenario. The author uploads an image - Screenshot.png in Post A. Post A is published. Post A will contain a reference to the path of the attachment. The author now wants to use the same Screenshot.png in Post B. For this, the author has to upload Screenshot.png again to Post B. Uploading again will create a new document - "Screenshot-1.png" and Post B will contain a reference to Screenshot-1.png. Attachments are managed along with the post. Attachments will be deleted when the post is deleted. LiteBlog follows this approach because the number of scenarios when a document is shared across post is very less. Also, the media library in Wordpress gets cluttered with too many unused documents or media.

Deleting attachment from a published post

A published post can be edited. Editing a published post causes a draft of the published post to be created in the background. When you delete an attachment from the post, the document corresponding to the attachment does not get immediately deleted. This ensures that the post which is already published in the site does not lose the link to the document from the Docs folder. When publishing a draft post (of an already published post), the documents in the published post are checked against the documents in the draft post. If any attachments in the published post are found missing in the attachments of the draft post, then the document of the missing attachment is deleted from the Docs folder.

Deleting attachment while deleting post

A post can be either a published post or a draft post. A published post can be edited, and there can be a maximum of one draft post associated with a published post. While deleting a published post or a draft copy of a published post, care should be taken to avoid deleting documents which are attached to the post.

Last edited Oct 11, 2013 at 9:07 AM by vijayst, version 6


No comments yet.