Topic: Creating gallery.xml from a database

Has anyone tried generating the gallery.xml file based on pictures that are referenced from a database?

What I want to do is pull the last 50 photos from the database, so that I can refresh SimpleViewer on the fly.

Thank You

Re: Creating gallery.xml from a database

I'm working on it!  wink

I'm developing a new index.php which will write the gallery.xml file from a MySQL database. It's not difficult at all, at the moment I can even order the photos by size, name or date but I want to allow tags and comments as well, and that's where I'm finding some trouble.

It basically opens a connection to the DB, grabs the image names, captions and dates and creates the XML file accordingly, then it publishes viewer.swf which loads the just-created XML file with the images we want.

Whenever I finish it (I started yesterday, so it should take me a couple more days/weeks), I'll let you all know  smile

Re: Creating gallery.xml from a database

I would be very interested in this tool.
If I could make a suggestion/request? For the caption can you incorporate the following as an option?

From buildgallery.php

$count = 0;
foreach($files as $key => $value) {

    $xml .= '
    <image>';
    $xml .= '<filename>'.$key.'</filename>';
    $count = $count + 1;
    //add auto captions&#58; 'Image X'
    if &#40;$showDownloadLinks&#41;&#123;        
        $xml .= '<caption><!&#91;CDATA&#91;Image '.$count.'/'.sizeof&#40;$files&#41;.'&#93;&#93;></caption>';

    &#125;
    $xml .= '</image>';

Basically instead of the default href caption I use "Image 1/100"

Thanks

Regards
Phil
http://www.phillipnorman.com

Re: Creating gallery.xml from a database

Please can you send me a link about your futur work...?
Thank you and congratulation for your idea !

Re: Creating gallery.xml from a database

There's much more in it than I first thought, but some things like tags and comments kind of work already:

you can see some progress here:
-> www oink in/pruebasv3/

(I'm still coding, so I might change it at any moment and it might even stop functioning while I modify stuff).

The good stuff: it's all in a couple of files, very very easy to install and configure. The comments system is based on phpcomments (old, well-known system). One single table (I want to keep it simple). Everything can be hidden if you don't want to use it (dates, captions, comments, tags,...). I'm also writing a lot of comments on the code for anyone to follow it easily and a lot of debugging info in case problems arise to someone installing it.

At the moment I'm worried of the number of lines shown by the CAPTION field. I want to show 2-3 lines for the image description + 2 lines for the image dates + 1-2 lines of tags + 1 line of comments. This makes 6-8 lines. If your monitor/resolution is too small it won't show them all! :-P and I don't think there's much I can do from the PHP side, I think I need to modify SV to achieve this. Do you know anything about this?

Does anyone know if I can decode SimpleViewer? Is that legal? :shock:  :?

Re: Creating gallery.xml from a database

Basically instead of the default href caption I use "Image 1/100"

What you want is the script to show the current image number and total number of images in the current view, right?

Ok, shouldn't be too difficult. But I'll definitely need to improve my caption space in order to show all of this!  big_smile

Re: Creating gallery.xml from a database

What you want is the script to show the current image number and total number of images in the current view, right?

Yes as per the code in my previous post. Personally I am not too interested in anything other than the file name or image number but of course others will be. I tend to keep the Caption very simple as per here.

How are you determining which images to pull from the data base? If I have a data base with 350 images in three different sizes how will I choose which ones to display in the simpleviewer gallery? Can I specify a list of image file names or or the image id numbers or something?

PS I don't know anything about data bases!!

Regards
Phil
http://www.phillipnorman.com

Re: Creating gallery.xml from a database

Yes as per the code in my previous post. Personally I am not too interested in anything other than the file name or image number but of course others will be. I tend to keep the Caption very simple as per here.

Done!  wink

How are you determining which images to pull from the data base? If I have a data base with 350 images in three different sizes how will I choose which ones to display in the simpleviewer gallery? Can I specify a list of image file names or or the image id numbers or something?

I'll have to create an uploader where you can create new galleries and upload new pictures to old galleries.

I guess you could always have everything on a single gallery and use your tags to separate your pictures one from the other...