0

Since there are some major privacy issues with alot of social networking sites I am trying to think about alternatives. One is to let the user keep all the information stored in some kind of file container. Now, I haven't found a single type of container that can hold "generic" information. Only for audio/video. What I want is a container that can be read by PHP with some kind of index file that lists up the users pictures in a image/ directory in the container, FOAF files (or some alternative XML-file describing users information and friends, etc.).

My thoughts was to let the user keep all their information and data stored in a container that can be imported/exported and deleted from my server (the prototype social networking site I am trying to create), and then uploaded to another site that might use the same format (not that I think that will ever happen, but the user still keeps all their pictures, data, comments, messages, etc).

The only thing I have come up with yet is to create a tar archive with the Archive_tar library which extracts and creates Tar-archives with an index-file describing which files are holding the messages (there might be several so each file won't be so large), what pictures are in the image/ folder and what are their names and what comments they have gotten etc. Maybe also the permissions for viewing each type of content.

Does there exist any generic file format of a container that I can use to keep all this information in one file with a tree-like index file? Or must i try and create something like this myself?

4
  • Not sure what you are asking, but the most generic and portable file format I can think of for this purpose is an XML file.
    – Gordon
    Jun 11, 2010 at 9:24
  • @Gordon The XML file would be a portable file format for indexing, but it woulnd't be a container to keep all the files and data stored in one single file EDIT: To explain it more simple: In a audio/video container, like Matroska f.ex., you have a video file and a audio file and a index file that describe the files inside the matroska container. I want the same just not for audio/video but for general files.
    – implmentor
    Jun 11, 2010 at 9:36
  • I still might not be getting it, but you can convert binary data, e.g. a JPG to base64 format and then store it inside an XML file. It will likely bloat the XML file, but isn't that basically what you are looking for? As an alternative, have you considered using SQLite instead?
    – Gordon
    Jun 11, 2010 at 9:47
  • @Gordon Thanks! I checked out XML+base64 and it looks good :) Haven't tried SQLite but I am looking into SDXF and Protocol Buffer
    – implmentor
    Jun 12, 2010 at 12:26

2 Answers 2

1

Do what the OpenDocumentFormat (ODF) does: produce a XML file with URIs (either local, eg. file:// or remote) pointing to other files. Give a common name to the XML file (root.xml or similar). Zip it all up and change the extension.

Zip is common everywhere - even Windows can open them natively - which makes it nice if the user wants to extract the pictures/movies/etc without having to download an extra tool.

0

Does there exist any generic file format of a container that I can use to keep all this information

No - and for good reason. You'd need very sophisticated locking semantics (which are very difficult to implement). Even with this perofrmance would be appalling - you are proposing writing your own filesystem in PHP? While, for example, Microsoft's OLE is a filesystem embedded into a single file - they are very selective about how they use this.

Start thinking 'directory' instead of 'file' and the solution will become clear, however I completely fail to see what relevance this has to the privacy problems of social networking sites let alone solving them.

C.

1
  • No, I am not writing the archive method in PHP, I would write it in C or equivalent, but I would want to use it in PHP, to read the contents. I have consider using tar archive, but I would like to have a PHP script that reads the header before untaring. The best solution would be to have an already-existing format, and I can't get any closer than XML or tar.
    – implmentor
    Jun 12, 2010 at 12:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.