Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister

Photo Database Application

by Limbic~Region (Chancellor)
on Apr 03, 2006 at 15:26 UTC ( #540946=perlquestion: print w/replies, xml ) Need Help??

Limbic~Region has asked for the wisdom of the Perl Monks concerning the following question:

I am looking for an application or perhaps just a framework that will allow me to store my photo files in a single place but all them to be presented as if they existed in multiple places. This seems like a good job for a database but representing a hierarchical structure with arbitrary depth seems less than obvious.

Let me give an example. Suppose I have a photo of our wedding that includes a half a dozen people. I may want to tag that photo under the main category of "Events" with a sub category of "Our Wedding". Additionally, I may want to tag the file under the main category of "People" and then under the sub categories for each person in the photo.

The goals of the application would be:

  • Allow the number of pictures being viewed at any one time to be limited to the scope of the currently selected category
  • Make the management of "tagging" files and creating the hierarchical structure user-friendly
  • Make use of the other "tags" for a file.

I realize the last goal isn't very well defined. Basically, I would want to know when I am viewing photos from our wedding who is in the picture by being able to view the other tags.

Does anyone know of such an application - preferrably OpenSource and in particular Perl?

Disclaimer: No, I haven't done my research. Yes, there may be a number of non-perl solutions. I don't know the first thing about the topic at hand to begin making any informed decisions and that is why I am asking here.

Cheers - L~R

Replies are listed 'Best First'.
Re: Photo Database Application
by chargrill (Parson) on Apr 03, 2006 at 19:59 UTC

    I've written something that's about 60% of what you're looking for, and it's in Perl, and while I hadn't considered licensing issues, I think I'd tend towards the PAL. I've kind of stalled with moving forward with refactoring and other changes, because it pretty much does everything I want (so far!).

    Here's why it could likely be adapted to what you're looking for:

    • All the files are in a big directory, with thumbnails in another directory, with filenames based on timestamps.
    • All pictures (for which I've logged in and added an entry ;) have an entry in a mysql database.

    I could easily see modifying my database schema to allow for 'tags', and the indexing CGI to query the database for a given set of tags.

    Here's a link to it in action, and the code for the indexing CGI is included here in a <readmore> should you be interested. (There's also some of the modules used listed here which I won't place here for (some!) brevity)

    I could actually be persuaded to add this for myself, as I find that I have 'sets' of pictures of my own that it might be nice to 'sort' by - house pictures, construction pictures, party pictures, dog pictures, etc. :)

    $,=42;for(34,0,-3,9,-11,11,-17,7,-5){$*.=pack'c'=>$,+=$_}for(reverse s +plit//=>$* ){$%++?$ %%2?push@C,$_,$":push@c,$_,$":(push@C,$_,$")&&push@c,$"}$C[$# +C]=$/;($#C >$#c)?($ c=\@C)&&($ C=\@c):($ c=\@c)&&($C=\@C);$%=$|;for(@$c){print$_^ +$$C[$%++]}
Re: Photo Database Application
by saberworks (Curate) on Apr 03, 2006 at 17:54 UTC
    It sounds like you're asking for two different things - a tagging system and a hierarchical categorization system. Most tagging systems I've seen allow you to tag a resource with any number of tags, but in general, tags aren't related in any way.

    Storing a hierarchy in a database is an old problem with many solutions. I have found this one to be particularly interesting because it allows the query of full branches with a single query (trade-off being slower inserts):
Re: Photo Database Application
by holli (Abbot) on Apr 03, 2006 at 15:35 UTC
    Not perl based (and not even open source) but my uncle, a hobby photographer, uses Thumbs+ and is quite confident with it. You will have to pay some money, but not much and I think it's worth the price.

    holli, /regexed monk/
Re: Photo Database Application
by novitiate (Scribe) on Apr 04, 2006 at 02:12 UTC
    Well, the filesystem gives you hierarchy and an RDBMS can give you the tagging you need. To start, I would mock this up with a CGI that has access to a predefined set of folders. You can get a quick tagging system going by making the md5sum of the file be the key in a single table sqlitedb and create entries like (md5sum,tag) each time a tag is applied to a file. there are a million good directory strategies, research them. For thumb presentation try mirroring the full size photos from the top of the tree like: root->photos and root->thumbs, so when someone clicks the thumb, just change the root. this is just a start but i think you'll see how easy it can be. the hardest part will be presentation. you might also want to look at INTERCHANGE, since it is good at cataloguing, you might get most of the functionality you need there.


    "...goodnight you princes of main(e)"  --The Cider House Rules

      I havn't used it, but there is CGI::Application::PhotoGallery. I would also check the C::A archives and wiki to see if there is anything else out there.


Re: Photo Database Application
by ChemBoy (Priest) on Apr 04, 2006 at 16:24 UTC

    I haven't tried it myself, largely because (like far too many other people) I've been working on-and-off on a similar project of my own, but it looks like FotoBilder might be exactly what you need. Fairly strictly web-based, and requires mod_perl (unless I'm very much mistaken), but if you don't mind those constraints, it seems like it could work pretty well for you.

    If God had meant us to fly, he would *never* have given us the railroads.
        --Michael Flanders

Re: Photo Database Application
by eric256 (Parson) on Apr 05, 2006 at 17:16 UTC

    I've been playing with something similar (havent' we all?). My solution is based on Win32 but I think the same idea will work for *nix. What I wanted was to have a system that in the end, regular applications could access the pictures through there tags. This meant either hacking into the windows file system (which seemed scary and dangerous) or abusing the current system. So I set out to abuse the current system! ;) It turns out that you can do Hard links in windows if you download the right tools. So i have a script monitor a directory, and when a picture is added, it takes all the directories and uses those as tags. For instance if i put a picture in 2005/March/Eric/Mountains it would be tagged with all four of those. Then hard links are distributed out into the other approriate directories. In this case a hard linke would be put in 2005, March, Eric, Mountains, 2005/March, 2005/Eric, 2005/Mountings, March/2005, March/Eric, etc. I'm still working on getting the monitoring right, but right now it looks very promising and exciting. I get the heirarchial access method of starting with broad tags and then as you enter directories you get pictures more and more related to what you want. In the end I want to then tack a web based interface to allow easier tagging and searching of pictures.

    I know this isn't quite what you want sense i don't have sub-tags likey are thinking, but maybe there is some way to weld the two ideas together ;). Of the top of my head sub categories could be folders prefixed with something like "." so that the two systems could be merged. Then when storing the categories in a DB you concat the main category with the sub category and store them that way. /me stops thinking out loud.

    Eric Hodges
Re: Photo Database Application
by Anonymous Monk on Apr 05, 2006 at 16:40 UTC
    You might be able to adapt Rubric to do what you want.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://540946]
Approved by Old_Gray_Bear
Front-paged by Anneq
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others studying the Monastery: (3)
As of 2020-07-04 00:13 GMT
Find Nodes?
    Voting Booth?

    No recent polls found