front page photo slideshow
Moderator: General Moderators
front page photo slideshow
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.
i want the pictures to load be pulled from the database if that is possible.
- Christopher
- Site Administrator
- Posts: 13596
- Joined: Wed Aug 25, 2004 7:54 pm
- Location: New York, NY, US
Re: front page photo slideshow
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.
http://snook.ca/archives/javascript/sim ... -slideshow
You could easily get the images from a database.
(#10850)
Re: front page photo slideshow
so i got the slideshow to work but when i try to pull the images from the db they dont come up
if i put in the actual url of the image it comes up ok
how can i get it to pull from the db?
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; ?>">
<? } ?>how can i get it to pull from the db?
- Christopher
- Site Administrator
- Posts: 13596
- Joined: Wed Aug 25, 2004 7:54 pm
- Location: New York, NY, US
Re: front page photo slideshow
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.
(#10850)
Re: front page photo slideshow
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>
- Christopher
- Site Administrator
- Posts: 13596
- Joined: Wed Aug 25, 2004 7:54 pm
- Location: New York, NY, US
Re: front page photo slideshow
Nope. Still doesn't show the images.
- Christopher
- Site Administrator
- Posts: 13596
- Joined: Wed Aug 25, 2004 7:54 pm
- Location: New York, NY, US
Re: front page photo slideshow
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.
(#10850)
Re: front page photo slideshow
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
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
works i changed
<img src="<?php echo $imgurl; ?><?php echo $rowcat['image']; ?>">
to
<img src="<?php echo $imgurl; ?><?php echo $rowcat->image; ?>">
<img src="<?php echo $imgurl; ?><?php echo $rowcat['image']; ?>">
to
<img src="<?php echo $imgurl; ?><?php echo $rowcat->image; ?>">
- Christopher
- Site Administrator
- Posts: 13596
- Joined: Wed Aug 25, 2004 7:54 pm
- Location: New York, NY, US
Re: front page photo slideshow
Or you could change mysql_fetch_object() to mysql_fetch_assoc() to get the row as an array. Glad you got it working.
(#10850)