[KimDaBa] Nice pictures online (reloaded)

Jean-Michel FAYARD boulot.dodo at laposte.net
Sat Feb 14 09:43:22 GMT 2004

I did quite some work to improve Kimdaba HTML export filter.
It's far from finished, but I wanted to know from you how much the idea sucks...

The demo is here

Those links apprarently didn't work yesterday when I posted
to the mailing-list, but I am told from someone outside my university
that you can now access them

Can somebody confirm it ?

Here is the README file you can find on the first link :



			   +     WHAT'S THIS ?   +

Q: Nice pictures 
A: Thank you, but they are not from me, but from Jesper, the author from Nederland of &kimdaba;   

Q: What is Kimdaba, and why it's great ? 
A: Check out the site http://ktown.kde.org/kimdaba/  
«	  I needed a tool to help me describe my images, and to search in the
pile of images. This is exactly what KimDaba is all about.

	  KimDaba focuses on three key points:
	   1)  It must be easy to describe a number of images at a time. It must
for example not take more than a few mouse clicks to mark all your images from
your holiday as being from Italy, 1992. KimDaba offers two ways of description
images one at a time, which is useful for writing text about images, and All
Simultaneously, which is useful for selecting a number of images, and setting
properties like location, persons on images, and date of image.
	   2)   It must be easy to search for images. KimDaba offers to describe
images with a number of properties. These includes date, persons on image,
location of image, plus a keyword field the user can use for custom keywords
like Album 7 or Holiday trip to Italy. With KimDaBa you can search for in each
of the categories - Find the images with Jesper on them.
	   3)   It must be easy to browse and View the images. When viewing
images, your focus often changes - one moment you are looking at images from
your holiday in 1992, and when seeing an image of a friend whom you spent that
holiday with, you focus suddenly changes, so you want to see all images of that
friend. »

Q: What is currently not so great ?
A: We cannot currently share all those info with others.
    They are a number of thing we can do to improve this :
	- Jasper plans to add an export ability, se we will
	we able to merge the databases from two persons who have KimDaBa

	- We could use the IPTC standard and hope other application
	will be smart enough to handle them correctly

	- HTML is _the_ universal standard.
	Kimdaba has a simple HTML filter, and on KDE you can find other
	very nice software to generate albums, but they of cours all
	loose the features 2) and 3) of Jasper's list, and are so
	boring linear.
	Why can't we do a proof of concept to see if we can add that
	to the HTML export ?

Q: Good idea ! I know a bit of PHP, I start to code it.
A: That's what I've begun to do, only not with PHP, but with Javascript+DOM+CSS.
    Not everyone has a PHP-able website, and what is very good with Javascript
    is that I will be able to use it with images stored on my CDs.

Q: Ok, with which browser does it work ?
A: Hopefully, it can work every standard compliant browser without too much headaches. 
    I work with MozillaFirebird 0.8 and Konqueror from KDE 3.2 and
    latest Opera.
    Internet Explorer would be another problem, but I don't have tested it.

    (As a side note, I run KDE 3.2 on Mandrake 10.0 Beta, and I had
    the good surprise to see KimDaBa in the software (not by default though))

Q: OK, how does it work ?
A:  Bad. It has a lot of bugs (Why doesn't this next button in the viewer do the same
    as clicking on the image) and missing features (I hope to be able to Search soon).
    Besides, it is ugly.

Q: No, I mean, how does it work ?
A: Ok, you have 4 main HTML pages :
    ThumbnailView.html    Viewer.html	Category.html  Kimdaba.html  

    In each of them, you can see a thing like :

	<script type="text/javascript" src="a.js"></script>
	<script type="text/javascript" src="util.js"></script>
	<script type="text/javascript" src="Kimdaba.js"></script>
    <body onload="chargement()">

    The a.js is generated from the index.xml database by a XSL-Transform stylesheet :
	$ xsltproc images.xsl index.xml > a.js
    This contain all setting generated from KimDaBa, and first of all, all the metadata
    converted in Javascript structure.
    See Appendix A

    All things common to every page goes in « util.js », and each page source a
${name}.js which contains all what create the page, including the chargement()

    We communicate context information between pages in the URL and store it
    in the global « Session » variable.
    See Appendix B

Q: It's really buggy.
A: Yes, it's javascript. 
    the Debug() and DebugSession() helps me to debug it.
    There are also a few tricks, such as adding a second parameter to the splitValidArgs() or parseURL() function 

Q: I have some comments, ideas, patches, flames,... Where can I send them ?
A: Let's discust on the mailing-list.

	    Appendix A:
	    Data structures :
Here are described the different global variables and their type :

* Categories *
is a Hash(   key,	value)
	    "Keyword",	  ||
	    "Locations",  \==>.icon
	    ...               .name  => "holiday"
                              .values=> List of : 
					          .value => "holiday"
                                                  .images=> List of index of the Images variable
getCategories()	    store the infos in Categories
imagesInACategory   store the infos in Categories[key].values[index].images

* Images *
is a List of :
	    .clefs  => valeurs
	    .label  => "img001"
	    .file   => "img001.jpg"
	    .options=>	Hash(	  key,	 ,    value)
				"Persons"  ==>  List of persons
				"Keywords" ==>  List of Keywords
getImages()	    store the infos in Images

* MemberGroups *
Note: I don't do anything with them currently.
is a Hash(   key,       value)
          "Spain"  =>	    .optionGroups  = "Locations"
                            .members	   = List "Madrid", "Barcelona", ...

* MISC *  Some global variable that are used :
DebugLevel   => put 1 in argument of Debug to see the debug infos.
		put a value bigger than DebugLevel when all works fine

	    Appendix B:
	    Context information :

the pages page in {Kimdaba,Category,Search,ThumbnailView,Viewer}.html are
called with a url in the form of :

On the other side, we have the very important Session variable :
Session : we maintain this object which has the following fields :
    Session.Pref is a hash of the session Preferences
    Session.Pref =
	End  =>20		(ThumbnailView.html) range of images to be displayed
	Category=>Persons	for Category.html	: the category to display
	ImageSize=>640		for Viewer.html	: the size of an image
	I=>0			Which image see in Viewer.html
    Session.Search	is a hash of the current search
    Session.Search =   
	Locations=>Grand Canyon
    Session.Images is an array of the images matching the search
    Session.String	     is the valid part of the Sessionearch
	"Persons=Spiff;Persons=Jesper;Persons=Anne Helene;Locations=Grand Canyon"

There are a couple of functions to parse the url to generate a session, or the inverse :
    generateAnchor( "Page.html", "Additional args for the url")
    generateURL( "Page.html", "Additional args for the url")

This two functions check what will go in Session.Pref 
This one call them, parse the rest of the URL to find a valid
search, and return an object from the same class as Session

More information about the Kphotoalbum mailing list