a bit more work on kfm, and thoughts on file tagging

I’ve changed the behaviour of the KFM file manager (demo) to require double-clicks rather than single-clicks, in order to choose a file. This is more in-keeping with how other file managers work.

I’ve also added the ability to select single or multiple files (click a file, then ctrl-click other files to add them to the selection). This is not useful for selecting a file for the FCKeditor, but is most definitely useful when you need to move a load of files to different directories, which I’ll implement soon enough (through drag’n’drop). Note the funky curved borders on selected files :-).

I was thinking about how to implement file-searching earlier, and have a few strategies in mind.

First, I think it should be possible to search by file name (obvious). Every time a file is added, a reference to it would be added to an indexing file, which could be searched quickly to find matches.

I think a more interesting thing, though, is the idea of Tags, where a file could be marked with Tags which describe what it’s for. For example, an MP3 could be tagged as “prog rock”, “comedy”, “spinal tap”, “majesty of rock”. This would allow files to be easily grouped together, despite their being in totally separate directories in actuality.

I have a number of practical applications for that in mind. For example, you could tag a load of images according to certain themes that they portray, and easily produce a gallery of images about one theme (or filtered with multiple tags for a more specifically themed gallery).

I know this isn’t clearly defined. It’s still kind of liquid in my head as well. I’m reading through the beagle website at the moment, as I think it is similar to what I’m trying to define.

As a postscript. I notice that I have just “tagged” this post as belonging to four separate categories. I believe this is similar to what I am trying to do with files – after all, it’s all information, right?

5 Replies to “a bit more work on kfm, and thoughts on file tagging”

  1. Would this help? It only reads ID3v1 tags, since ID3v2.x has some interesting problems, least of which ain’t the fact that the tag can be located *anywhere* in the file (even though it *usually* is located in the beginning) … anyway, HTH, all rights reversed 🙂

    is_valid = true;
    $this->artist = $this->strippad(substr($data, 3, 30));
    $this->title = $this->strippad(substr($data, 33, 30));
    $this->album = $this->strippad(substr($data, 63, 30));
    $this->year = $this->strippad(substr($data, 93, 4));
    $this->comment = $this->strippad(substr($data, 97, 29));
    $this->track_byte = substr($data, 126, 1);
    $this->track_number = ord($this->track_byte);
    $this->genre_byte = substr($data, 127, 1);
    if (isset($GLOBALS[“genres”][ord($this->genre_byte)])) {
    $this->genre_text = $GLOBALS[“genres”][ord($this->genre_byte)];
    }
    }
    }
    }

    function strippad ($data) {
    return trim(strtr($data, chr(0), ‘ ‘));
    }
    }

    ?>

  2. Hi.
    I like your ideas and have a suggestion..

    Since I like files for storing data, Ive always combined it with a database to hold info since it is much easier to administer. Would a thing like this be possible ? Im thinking of something like a configuration option that states some sql queries that can be modified..

    Anyway. Good luck with the editor in the first place, I’d just give my 2c 😉

  3. Janich, that will certainly be possible. I am working on this mainly for my own company’s CMS, which uses databases a lot. I will be writing customisable “hooks” into the PHP, where you can assign functions to handle various things (to check whether a file is allowed to be uploaded at a certain location, to give notice to a database that a file has been moved/renamed, etc).

    I’ll write up some examples once I have the hooks built.

Comments are closed.