Page 1 of 1
front page photo slideshow
Posted: Tue Dec 28, 2010 12:17 am
by webdzine
anybody know of any good photo slideshow script that i can add to my frontpage of my site,
i want the pictures to load be pulled from the database if that is possible.
Re: front page photo slideshow
Posted: Tue Dec 28, 2010 12:30 am
by Christopher
I recently used this amazing little jQuery on-liner to create a basic slideshow on a website. I am a happy customer.
http://snook.ca/archives/javascript/sim ... -slideshow
You could easily get the images from a database.
Re: front page photo slideshow
Posted: Sat Jan 01, 2011 4:14 pm
by webdzine
so i got the slideshow to work but when i try to pull the images from the db they dont come up
Code: Select all
<?php
$imgurl = 'www.***********.com/images/pictures/';
$queryclient = "SELECT * FROM pictures WHERE type='1'";
$rscat = mysql_query($queryclient) or die('Error, query failed');
while($rowcat=mysql_fetch_object($rscat)){
?>
<img src="http://<? $imgurl; ?><? echo $rowcat->image; ?>">
<? } ?>
if i put in the actual url of the image it comes up ok
how can i get it to pull from the db?
Re: front page photo slideshow
Posted: Mon Jan 10, 2011 1:56 pm
by webdzine
?
Re: front page photo slideshow
Posted: Mon Jan 10, 2011 2:48 pm
by Christopher
Did you read that post? You need to link to the jQuery library, add the CSS they provide, initialize jQuery, and put the images in a <div> with a specific class name. Did you do all of that? All you show is getting the images, but not where you insert that HTML.
Re: front page photo slideshow
Posted: Tue May 10, 2011 8:12 pm
by webdzine
Here is the code that i have in the site, yet nothing shows up
Code: Select all
<script>
$(function(){
$('.fadein img:gt(0)').hide();
setInterval(function(){
$('.fadein :first-child').fadeOut()
.next('img').fadeIn()
.end().appendTo('.fadein');},
3000);
});
</script>
<style>
.fadein {
position:relative;
width:661px;
height:501px;
}
.fadein img {
position:absolute;
left:0;
top:0;
padding: 5px 165.5px;
height:480px;
width:406px;
}
</style>
<div class="fadein" >
<?php
$imgurl = '/images/homepage/';
$queryclient = "SELECT * FROM pictures_homepage";
$rscat = mysql_query($queryclient) or die('Error, query failed');
while($rowcat=mysql_fetch_object($rscat)){
?>
<img src="/images/homepage/<?php echo $rowcat['image']; ?>" >
<? } ?>
</div>
Re: front page photo slideshow
Posted: Wed May 11, 2011 1:06 am
by Christopher
You might need to put the styles before the script.
Re: front page photo slideshow
Posted: Wed May 11, 2011 6:57 pm
by webdzine
Nope. Still doesn't show the images.
Re: front page photo slideshow
Posted: Thu May 12, 2011 7:07 pm
by Christopher
Well ... it is probably some tiny detail wrong. Did you ever get their demo working on your site? (
http://snook.ca/technical/fade/fade.html) If you get that working then try hard coding your images to replace theirs. The add the loop.
Re: front page photo slideshow
Posted: Wed May 18, 2011 5:00 pm
by webdzine
when i put the the full image like in the demo then it works but when i try to put the code for it to pull from the db it doesn't work.
please let me know if you see anything in my code
Code: Select all
<script>
$(function(){
$('.fadein img:gt(0)').hide();
setInterval(function(){
$('.fadein :first-child').fadeOut()
.next('img').fadeIn()
.end().appendTo('.fadein');},
3000);
});
</script>
<style>
.fadein { position:relative; width:500px; height:332px; }
.fadein img { position:absolute; left:0; top:0; }
</style>
<div class="welcomebox2">
<div class="heading">
</div>
<div class="fluidbox3">
<div class="fadein" >
<?php
$imgurl = 'http://***************.net/images/homepage/';
$queryclient = "SELECT * FROM pictures_homepage";
$rscat = mysql_query($queryclient) or die('Error, query failed');
while($rowcat=mysql_fetch_object($rscat)){
?>
<img src="<?php echo $imgurl; ?><?php echo $rowcat['image']; ?>">
<? } ?>
</div>
</div>
</div>
</div>
Re: front page photo slideshow
Posted: Wed May 18, 2011 5:16 pm
by webdzine
works i changed
<img src="<?php echo $imgurl; ?><?php echo $rowcat['image']; ?>">
to
<img src="<?php echo $imgurl; ?><?php echo $rowcat->image; ?>">
Re: front page photo slideshow
Posted: Thu May 19, 2011 2:20 pm
by Christopher
Or you could change mysql_fetch_object() to mysql_fetch_assoc() to get the row as an array. Glad you got it working.