It shouldn't be too difficult actually. The key is just to output the portion in red below inside your configuration code dynamically:
Code:
<script type="text/javascript">
var mygallery=new fadeSlideShow({
wrapperid: "fadeshow1", //ID of blank DIV on page to house Slideshow
dimensions: [250, 180], //width/height of gallery in pixels. Should reflect dimensions of largest image
imagearray: [
["http://i26.tinypic.com/11l7ls0.jpg", "", "", "Nothing beats relaxing next to the pool when the weather is hot."],
["http://i29.tinypic.com/xp3hns.jpg", "http://en.wikipedia.org/wiki/Cave", "_new", "Some day I'd like to explore these caves!"],
["http://i30.tinypic.com/531q3n.jpg"],
["http://i31.tinypic.com/119w28m.jpg", "", "", "What a beautiful scene with everything changing colors."] //<--no trailing comma after very last image element!
],
displaymode: {type:'auto', pause:2500, cycles:0, wraparound:false},
persist: false, //remember last viewed slide and recall within same session?
fadeduration: 500, //transition duration (milliseconds)
descreveal: "ondemand",
togglerid: ""
})
</script>
The rest can remain static as is. You might end up with something like:
Code:
<script type="text/javascript">
var mygallery=new fadeSlideShow({
wrapperid: "fadeshow1", //ID of blank DIV on page to house Slideshow
dimensions: [250, 180], //width/height of gallery in pixels. Should reflect dimensions of largest image
<?
echo "imagearray:[\";
$query = "SELECT * FROM gallery";
$result = mysql_query($query);
while($r=mysql_fetch_array($result)){
echo "[\"$r[imagepath]\", \"$r[link]\", \"\", \"$r[descp]\"],\n";
echo "],";
?>
displaymode: {type:'auto', pause:2500, cycles:0, wraparound:false},
persist: false, //remember last viewed slide and recall within same session?
fadeduration: 500, //transition duration (milliseconds)
descreveal: "ondemand",
togglerid: ""
})
</script>
Note that the pseudo code above does not remove the very last comma (",") that should not exist after the very last array element of the image. You'll need to do that.
Basically the idea is just to output the aforementioned chunk of code inside the script dynamically so it looks exactly as if you had manually defined it on your page.
Bookmarks