You're looking at the right forum thread but the wrong code. (The code you posted above is specific to a user's own test case using ASP.NET Web API.)
The code you should be using is in this forum post.
Put the following code in a file named 'config.php' and upload it to the same directory as the HTML page which contains your gallery's embedding code. Also in this directory, create a folder named 'images' and upload all your images there.
<?php
header("Content-type: application/xml");
function GetDirArray($folder)
{
$handle=opendir($folder);
while ($file=readdir($handle))
{
if ($file!="." && $file!="..")
{
$ret[count($ret)]=$file;
}
}
closedir($handle);
sort($ret);
return $ret;
}
$gallery=GetDirArray('images');
echo '<?xml version="1.0" encoding="UTF-8"?>';
echo '<juiceboxgallery title="Juicebox Gallery">';
for ($i=0; $i<sizeof($gallery); $i++)
{
echo '<image imageURL="images/'.$gallery[$i].'" thumbURL="images/'.$gallery[$i].'" linkURL="" linkTarget="">';
echo '<title></title>';
echo '<caption></caption>';
echo '</image>';
}
echo '</juiceboxgallery>';
?>
Now add the following to your gallery's embedding code:
configUrl : 'config.php',
For example, your gallery's embedding code might look something like this:
<!--START JUICEBOX EMBED-->
<script src="jbcore/juicebox.js"></script>
<script>
new juicebox({
configUrl: "config.php",
containerId : "juicebox-container",
galleryWidth: "100%",
galleryHeight: "100%",
backgroundColor: "#222222"
});
</script>
<div id="juicebox-container"></div>
<!--END JUICEBOX EMBED-->
Now, your gallery will display all images in the 'images' folder and each time you upload images to the 'images' folder, they will automatically be displayed in the gallery when the gallery is viewed.