PDA

View Full Version : How to use Ultimate Fade-in slideshow (v1.5) with PHP/MySQL for img src



hyperpilot
08-30-2007, 11:09 AM
1) Script Title: Ultimate Fade-in slideshow (v1.5)

2) Script URL (on DD): http://www.dynamicdrive.com/dynamicindex14/fadeinslideshow.htm

3) Describe problem:
I love the Ultimate Fade-in slideshow script. It has greatly improved the look of my static pages. However, the project I am currently working on needs an automatic fading slideshow that uses specific images that correlate to data that is already housed in MySQL database. I'm using php and all the data pulls just fine for text. (i.e.<?php echo $row_Recordset1['var']; ?> ) When I attempt to insert a <?php echo ;?> command to the javascript "fadeimages[0]=" such as "fadeimages[0]=[".<?php echo $row_Recordset1['photo1']; ?> ", "", ""]" the script breaks and I get nothing.

Could you assist me with solving this problem, such that the really great Ultimate Fade-in slideshow (v1.5) script works with php/MySQL for my project?

Thanks so much in advance

jscheuer1
08-30-2007, 01:57 PM
It looks like you have a dot and a space that don't belong:



fadeimages[0]=[".<?php echo $row_Recordset1['photo1']; ?> ", "", ""]

However, there is a fairly easy way to troubleshoot what you are attempting. Setup the page and view it in the browser. Then, if there are no server errors reported, look at the browser's 'view source' to see the javascript array being served. If it doesn't conform to the script's example array, modify your PHP part so that it does.

hyperpilot
08-31-2007, 04:01 AM
Copious quantities for your very helpful assistance. It works now. Most happy.
Cheers.

sickstick
03-30-2008, 07:31 AM
Hey, I'm working on the same piece of code currently, and I was wondering if you could show the entire chunk of code that you have written for it. Mine is broken beyond repair now, and seeing yours would help immensely.

strikerbear
04-24-2008, 03:24 AM
I'm trying to load all my images listed in the database table to cycle through the slide show. The application is to cycle thumbnails that will link to a detail page.

Is there a way the "var fadeimages = new Array()" can be manipulated instead of the "fadeimages[0]=[".<?php echo $row_Recordset1['photo1']; ?> ", "", ""]"?

my database query is:
mysql_select_db($database_smartmove, $smartmove);
$query_rsSlideshow = "SELECT PropertyID, Property_address, Price, Property_Thumb1 FROM property";
$rsSlideshow = mysql_query($query_rsSlideshow, $smartmove) or die(mysql_error());
$row_rsSlideshow = mysql_fetch_assoc($rsSlideshow);
$totalRows_rsSlideshow = mysql_num_rows($rsSlideshow);

$result = $query_rsSlideshow;

Any input is appreciated :)

darshanpm
08-24-2008, 10:41 AM
Hi hyperpilot or anyone,

I am trying to achieve a similar slideshow using php+mysql. I am a newbie and it would be great if hyperpilot you can give me help or your script. It would be highly appreciated.....

Waiting for your reply,

Thanks,
Danny

strikerbear
08-26-2008, 12:41 PM
Hi,

I used the SQL from my previos post. I used this viewer in a PHP page. Then used this script in the head section of the web page:

<script>

// Set the javascript slideshow speed (in milliseconds)
var SlideShowSpeed = 8000;

// Set the javascript slideshowduration of crossfade (in seconds)
var CrossFadeDuration = 3;
// Set javascript slideshow var array from php and mysql
<?php
echo "var Picture = new Array();\n";
if($totalRows_rsSlideshow > 0) {
mysql_data_seek($rsSlideshow,0);
for($i=1;$row_rsSlideshow = mysql_fetch_array($rsSlideshow);$i++) {
echo "Picture[" . $i . "]=\"" . $row_rsSlideshow['Property_Thumb1'] . "\"\n";
}
}
echo "var Price = new Array();\n";
if($totalRows_rsSlideshow > 0) {
mysql_data_seek($rsSlideshow,0);
for($i=1;$row_rsSlideshow = mysql_fetch_array($rsSlideshow);$i++) {
echo "Price[" . $i . "]=\"" . $row_rsSlideshow['Price'] . "\"\n";
}
}
echo "var Caption = new Array();\n";
if($totalRows_rsSlideshow > 0) {
mysql_data_seek($rsSlideshow,0);
for($i=1;$row_rsSlideshow = mysql_fetch_array($rsSlideshow);$i++) {
echo "Caption[" . $i . "]=\"" . $row_rsSlideshow['Property_address'] . "\"\n";
}
}
echo "var PropertyID = new Array();\n";
if($totalRows_rsSlideshow > 0) {
mysql_data_seek($rsSlideshow,0);
for($i=1;$row_rsSlideshow = mysql_fetch_array($rsSlideshow);$i++) {
echo "PropertyID[" . $i . "]=\"" . $row_rsSlideshow['PropertyID'] . "\"\n";
}
}
?>

var tss;
var iss;
var jss = 1;
var pss = Picture.length-1;

var preLoad = new Array();
for (iss = 1; iss < pss+1; iss++){
preLoad[iss] = new Image();
preLoad[iss].src = Picture[iss];}

function runSlideShow(){
if (document.all){
document.images.PictureBox.style.filter="blendTrans(duration=2)";
document.images.PictureBox.style.filter="blendTrans(duration=CrossFadeDuration)";
document.images.PictureBox.filters.blendTrans.Apply();}
document.images.PictureBox.src = preLoad[jss].src;
if (document.getElementById) document.getElementById("Price").innerHTML= Price[jss];
if (document.getElementById) document.getElementById("CaptionBox").innerHTML= Caption[jss];
if (document.all) document.images.PictureBox.filters.blendTrans.Play();
jss = jss + 1;
if (jss > (pss)) jss=1;
tss = setTimeout('runSlideShow()', SlideShowSpeed);
}
</script>

</head>

The script is run by the top of the body tag:

<body onload=runSlideShow() class="mySyleCSS">

Then where the viewer is to go in the body:

<table width="160" border=0 cellpadding=0 cellspacing=0>
<tr>
<td colspan="3" align=center bgcolor=#000000 id=CaptionBox3>&nbsp;</td>
</tr>
<tr>
<td colspan="3" align=center bgcolor=#000000 class=Caption id=CaptionBox3>
Featured Listing</td>
</tr>
<tr>
<td colspan="3" align=center bgcolor=#000000 id=CaptionBox3></td>
</tr>
<tr>
<td width=10 >&nbsp;</td>
<td width=140 ><img src=Image001.jpg name=PictureBox width=140 class="PictureBox" /></td>
<td width=10 >&nbsp;</td>
</tr>
<tr>
<td colspan="3" align=center bgcolor=#000000 id=CaptionBox3></td>
</tr>
<tr>
<td colspan="3" align=center bgcolor=#000000 class=Caption id=Price></td>
</tr>
<tr>
<td colspan="3" align=center bgcolor=#000000 class=Caption id=CaptionBox></td>
</tr>
</table>

Hope this gives you a starting point!

netwiseit
11-28-2008, 07:03 PM
Hello all,
Newbie to posting here but I have a question:

I've used the code above and when i view source the image location is "images\testpic.jpg" which is correct as that's the image location entered into the record that has been input.

When I wish to display a dynamic image on a webpage i.e. viewcostume.php the image displays correctly but when I use the script it doesn't display the image because the file location is "images\testpic.jpg" instead of "testpic.jpg" which is what is required for the script in order to work correctly.

Has their been an update to resolve this issue / is their a work around that will mead that I have to alter the database structure in order to compensate for the "images\"part of the database record.

I'm also looking for a simple image upload script that will allow the image to be uploaded after the record has been added to the database.

Any help would be greatly appreciated.

netwiseit.

strikerbear
11-29-2008, 05:28 PM
Hello all,
Newbie to posting here but I have a question:

I've used the code above and when i view source the image location is "images\testpic.jpg" which is correct as that's the image location entered into the record that has been input.

When I wish to display a dynamic image on a webpage i.e. viewcostume.php the image displays correctly but when I use the script it doesn't display the image because the file location is "images\testpic.jpg" instead of "testpic.jpg" which is what is required for the script in order to work correctly.

Has their been an update to resolve this issue / is their a work around that will mead that I have to alter the database structure in order to compensate for the "images\"part of the database record.

I'm also looking for a simple image upload script that will allow the image to be uploaded after the record has been added to the database.

Any help would be greatly appreciated.

netwiseit.

Hi,

I'm a little slow, so please forgive this question if it sounds to simple or goofy. Where are your images stored on the server? For example, is it in an images folder? Also where in relation to the script is it? Finally what address location does the database have in it? The database entry could be: testpic.jpg or images/testpic.jpg or /images/testpic.jpg or ../images/testpic.jpg -- this all depending on the location relationships between image, script, and/or web page locations. Hope this dosen't confuse the issue more. Like I said I'm kind of slow.....

KashifMunir
11-25-2010, 02:27 PM
Hello Friends. I am New here and i was trying top add this script in page.

Can any one tell me how can i use the -Auto playing slideshow with descriptions shown automatically using the "peekaboo" option.

I want to use this with MySQL images.

I am trying from last 4 Days. but cant find any solution. i hope any one can tell me how can i use this

my Data base is


CREATE TABLE `gallery_photos` (
`photo_id` bigint(20) unsigned NOT NULL auto_increment,
`photo_filename` varchar(25) default NULL,
`photo_caption` text,
`photo_category` bigint(20) unsigned NOT NULL default '0',
PRIMARY KEY (`photo_id`),
KEY `photo_id` (`photo_id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;



insert into gallery_photos values
(1, '1.jpg', 'this his his ihgfhg', 1),
(2, '2.jpg', 'this his his ihgfhg', 1),
(3, '3.jpg', 'this his his ihgfhg', 1),
(4, '4.jpg', 'this his his ihgfhg', 1),
(5, '5.jpg', 'this his his ihgfhg', 1),
(6, '6.jpg', 'dfggfsdf', 1);

KashifMunir
11-25-2010, 03:04 PM
Thanks Friends i done that with myself. but i have a problem with the image sizing. how can i fix thm in the frame

jscheuer1
11-25-2010, 03:23 PM
In general response to the many folks that have added their own questions to this thread:


(T)here is a fairly easy way to troubleshoot what you are attempting. Setup the page and view it in the browser. Then, if there are no server errors reported, look at the browser's 'view source' to see the javascript array being served. If it doesn't conform to the script's example array, modify your PHP part so that it does.

One may at the same time view HTML code that the server has generated. If there is any and if any of that doesn't conform to what is required, again - the PHP code must be changed so that it does.

One should bear in mind that version 1.51 of Ultimate Fade is now way out of date. But these principles apply to the most recent version (2.4?) and any in between as well.

If any of you want more help, please start a new thread for your specific question. Follow the posting guidelines for a new thread (http://www.dynamicdrive.com/forums/showpost.php?p=7&postcount=1).

Also include a link to the page on your site that has the problematic code, so we can check it out.