comports Posted January 5, 2007 Share Posted January 5, 2007 HI Folk,New to this Forum and fairly new to PHP. I have an issue with firefox and wonder if you can help.Quite simple really. It reads the contents of a folder into an array and display number 1. Increments the variable, refreshes the page and displays image 2 and so on. All fine in IE. BUt when I view it in Forefox it displays image 1, refreshes and jumps straight to the last image in the folder....??Help.. ??? ???Thanks in advance.Ash Quote Link to comment Share on other sites More sharing options...
Perad Posted January 5, 2007 Share Posted January 5, 2007 Do you want to post what you have, its hard to blindly guess.If it works in IE, check the output code. Firefox doesn't process php, it processes what php outputs so logic would suggest that the problem is with that. Quote Link to comment Share on other sites More sharing options...
comports Posted January 5, 2007 Author Share Posted January 5, 2007 Hi Perad, Thanks fo rthe quick response. My code..[code]<?phperror_reporting(0);$folder = ("../cane-corso/images/gallery/");$num = $_GET["num"];$dir = opendir($folder);print"<HTML><HEAD><TITLE>Cane Corso Slide Show</TITLE><META NAME=\"Author\" CONTENT=\"Ashley Byrne\"><META NAME=\"Keywords\" CONTENT=\"Image Gallery Slideshow\"><META NAME=\"Description\" CONTENT=\"\"><link rel=\"stylesheet\" href=\"style2.css\"></HEAD><BODY bgcolor=\"#FF99CC\"><center><table border=\"5\" cellspacing=0 cellpadding=0 width=\"100%\" height=\"100%\" bgcolor=\"#FF99CC\"><table bgcolor=\"#FF99CC\">";$dir = opendir($folder);$i=1;while ($a = readdir($dir)) {if($a != "." && $a != ".." && $a != "text"){$files[$i] = $a;++$i;}}$total = count($files); if ($num==""){ $num=="1"; }// resize the image if its too big$maxwidth="600";list($width, $height, $type, $attr) = getimagesize($gallery.$folder.$files[$num]); if($width>$maxwidth){ $widthpc = round(($maxwidth/$width)*100); $width = round(($width*$widthpc)/100); $height = round(($height*$widthpc)/100); $attr="width=".$width." height=".$height; } Else{ $attr="width=".$width." height=".$height; }print "<tr><td><center><b>".substr($files[$num],0,-4)."</b> (". $num. " of ". $total.")</b></td></tr>";print "<tr><td><center><img src=\"".$gallery.$folder.$files[$num]."\" ".$attr." border=1><br></td></tr>";print "<tr><td><br><center><a href=\"javascript:parent.window.close()\"><font color=\"white\">--| End slideshow |--</a></td></tr>";while ($num < $total){ $num = ($num+1);print "<META HTTP-EQUIV=\"refresh\" content=\"3; URL=?folder=".$folder."&num=".$num."\"></td></tr></table>"; }?>[/code] Quote Link to comment Share on other sites More sharing options...
taith Posted January 5, 2007 Share Posted January 5, 2007 when in ff, go to the first picture, quickly right click the page, go to view source, what do you have in there for the[code]<META HTTP-EQUIV=\"refresh\" content=\"3; URL=?folder=".$folder."&num=".$num."\">[/code]? that'll tell you if its an issue with the redirecting, or where its a math issue...i also cleaned up your code a little :-)[code]<?php$folder = ("../cane-corso/images/gallery/");$num = $_GET["num"];if (empty($num)) $num=="1";$dir = opendir($folder);print"<HTML><HEAD><TITLE>Cane Corso Slide Show</TITLE><META NAME=\"Author\" CONTENT=\"Ashley Byrne\"><META NAME=\"Keywords\" CONTENT=\"Image Gallery Slideshow\"><META NAME=\"Description\" CONTENT=\"\"><link rel=\"stylesheet\" href=\"style2.css\"></HEAD><BODY bgcolor=\"#FF99CC\"><center><table border=\"5\" cellspacing=0 cellpadding=0 width=\"100%\" height=\"100%\" bgcolor=\"#FF99CC\"><table bgcolor=\"#FF99CC\">";$dir=opendir($folder);while ($a = readdir($dir)) if($a != "." && $a != ".." && $a != "text") $files[] = $a;$total = count($files)-1;$maxwidth="600";list($width, $height, $type, $attr) = getimagesize($gallery.$folder.$files[$num]);if($width>$maxwidth){ $widthpc = round(($maxwidth/$width)*100); $width = round(($width*$widthpc)/100); $height = round(($height*$widthpc)/100); $attr="width=".$width." height=".$height;}else $attr="width=".$width." height=".$height;print "<tr><td><center><b>".substr($files[$num],0,-4)."</b> (". $num. " of ". $total.")</b></td></tr>";print "<tr><td><center><img src=\"".$gallery.$folder.$files[$num]."\" ".$attr." border=1><br></td></tr>";print "<tr><td><br><center><a href=\"javascript:parent.window.close()\"><font color=\"white\">--| End slideshow |--</a></td></tr>";while($num < $total){ $num++; print "<META HTTP-EQUIV=\"refresh\" content=\"3; URL=?folder=".$folder."&num=".$num."\"></td></tr></table>";}?>[/code] Quote Link to comment Share on other sites More sharing options...
comports Posted January 5, 2007 Author Share Posted January 5, 2007 Thanks Taith,It's very interesting but I guess it goes back to the "Firefox does not process php" line. My source does contain the correct line[code]<META HTTP-EQUIV="refresh" content="3; URL=?folder=../cane-corso/images/gallery/&num=2">[/code]but also contains the same code with each of the image numbers in it so I get:[code]<META HTTP-EQUIV="refresh" content="3; URL=?folder=../cane-corso/images/gallery/&num=2"><META HTTP-EQUIV="refresh" content="3; URL=?folder=../cane-corso/images/gallery/&num=3"><META HTTP-EQUIV="refresh" content="3; URL=?folder=../cane-corso/images/gallery/&num=4"><META HTTP-EQUIV="refresh" content="3; URL=?folder=../cane-corso/images/gallery/&num=5"><META HTTP-EQUIV="refresh" content="3; URL=?folder=../cane-corso/images/gallery/&num=6">[/code]etc... all the way to the last imagenumber in the array.. I guess it reads the last line and refreshes but using the last number..!Is there a way to stop this..? Quote Link to comment Share on other sites More sharing options...
taith Posted January 5, 2007 Share Posted January 5, 2007 yup... ie reads <meta> tags top down, ff reads bottom up...scrap this[code]while($num < $total){ $num++; print "<META HTTP-EQUIV=\"refresh\" content=\"3; URL=?folder=".$folder."&num=".$num."\"></td></tr></table>";}[/code]use this in its place[code]echo "<META HTTP-EQUIV=\"refresh\" content=\"3; URL=?folder=".$folder."&num=".$num."\"></td></tr></table>";[/code] Quote Link to comment Share on other sites More sharing options...
comports Posted January 5, 2007 Author Share Posted January 5, 2007 Thanks - Changed the code but it now just refreshes and show image1 each time and does not step through to the next image..?? :'( Quote Link to comment Share on other sites More sharing options...
taith Posted January 5, 2007 Share Posted January 5, 2007 try this... :-P thought that would happen...[code]echo "<META HTTP-EQUIV=\"refresh\" content=\"3; URL=?folder=".$folder."&num=".$num+1."\"></td></tr></table>";[/code] Quote Link to comment Share on other sites More sharing options...
comports Posted January 5, 2007 Author Share Posted January 5, 2007 Thanks Taith,Your are a superstar..! I had to mod it a bit to get it move to the next image but that's ace. See it working here:-[url=http://www.comports.net/cane-corso/pictures.php?folder=../cane-corso/images/gallery/&show=y&num=1]http://www.comports.net/cane-corso/pictures.php?folder=../cane-corso/images/gallery/&show=y&num=1[/url] and click on slideshow..Thanks a MillionAsh Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.