0

I have a site where I can upload images with some info (startdate, enddate, duration, url)

I want to make a SlideShow that choose those pictures that is > $startdate && < $enddate. And I want each picture to be displayed as long as I've set it to in the value $duration. My Javascript so far is like this:

<script src="http://code.jquery.com/jquery-latest.min.js"></script>
<script>
function showPic1(){
$('#test').html("<img src=\"$url" width=" 400 " height=" 300 ">");
setTimeout(showPic2, $dur);}

function showPic2(){
$('#test').html("<img src=\"$url" width=" 400 " height=" 300 ">");
setTimeout(showPic1, 9000);}

showPic1();
</script>
<div id="test"><img src='http://haga.mizgalski.se/upload/upload/bild1.jpg' width='400' height='300'></div>

Pretty simple.. But how can I autogenerate this javascriptcode with exemple bash-script from a database?!

Any Idéas?

0

You could use the -execute switch mysql -e

foo=`mysql -u user_name_here -p password_here -s -N -e "SELECT id FROM the.host WHERE name='$the_url'"`
echo $foo
echo "<some>$foo<\/some>" >> /file/path/to_name_of_output.js

But why not use PHP or PERL?

Your Answer

By clicking "Post Your Answer", you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.