Topic: Create Gallery from MySQL Data Base instead from xml file [SOLVED]

Hello,

this is really a cool gallery template.

Now I am trying to implement on a web page. But since I want to use more than one galleries and do all of it dynamically (i.e. to be configurated by the owner of the page), I would like to use data from a database instead of the config.xml file. Is that possible? And if yes, how?

Thank you in advance!

Cheers
Frank

Re: Create Gallery from MySQL Data Base instead from xml file [SOLVED]

Please see the following FAQ. (There are a couple of links in the FAQ which might be useful.)
Can Juicebox handle a custom data source, for example RSS or Instagram?

Every Juicebox gallery must have a 'config.xml' file (where the gallery's configuration options and image data are stored).
However, the 'config.xml' does not need to be a static file created when the gallery is authored. It can be generated dynamically (by a server-side scripting language such as PHP) at the time the gallery is displayed.

You'd need to point Juicebox towards a PHP (or alternative language) script using a configURL entry in your gallery's embedding code, for example:

<!--START JUICEBOX EMBED-->
<script src="jbcore/juicebox.js"></script>
<script>
    new juicebox({
        containerId: "juicebox-container",
        galleryWidth: "100%",
        galleryHeight: "100%",
        backgroundColor: "#222222",
        configUrl: "config.php"
    });
</script>
<div id="juicebox-container"></div>
<!--END JUICEBOX EMBED-->

The output of the 'config.php' file would need to be in the format of a regular Juicebox 'config.xml' file but, within the script, you could pull in data from whatever source you like (such as a MySQL database).

It would certainly be possible to do but knowledge of PHP (or similar) and how to query your database would be required.

There is a simple example of a dynamically generated configuration file (to display images from a designated web server directory) in this forum post which might help.

I hope this points you in the right direction.

Re: Create Gallery from MySQL Data Base instead from xml file [SOLVED]

Hi Steven @ Juicebox!

Yes, I figured out how to do it following your advice. Thank you very much, it works!

Cheers
Frank

Re: Create Gallery from MySQL Data Base instead from xml file [SOLVED]

That's great!
Thank you for letting me know.