HELP Please - I have hit a wall in trying to get the following perl created web page to work correctly. It is designed to find all the pictures (.jpg) in all folders below the designated one and to then display them in individual slideshows. I have a version of the page running succesfully by using html and javascipt (I define the picture directories) but can not translate the slideshow element to be written by perl. The full script I have is below:
#Start with the Directories
$pat = "images/Photos/";
opendir THEDIR, $pat;
@alldirs = readdir THEDIR;
closedir THEDIR;
# Print HTTP header and opening HTML tags.
print "Content-type: text/html\n\n";
print "<HTML><HEAD>\n";
print "<script type=\"text/javascript\">\n";
print "<!--\n";
# Next is files in each Directory
foreach $d (@alldirs) {
$pat = "images/Photos/$d";
if (length($d) > 3){
opendir THEDIR, $pat ;
@allfiles = readdir THEDIR;
closedir THEDIR;
$x=0;
foreach $i (@allfiles) {
if ($i =~ "jpg") {
$x++;
print "var $d$x=new Image()\n";
print "$d$x.src=\"$pat/$i\"\n";
}# end if
}# end foreach
push (@count, $d);
push (@count, $x)
}#end if
}#end foreach
print "</script>\n";
print "</HEAD>\n";
print "<BODY LEFTMARGIN=0 TOPMARGIN=0 MARGINWIDTH=0 MARGINHEIGHT=0>\n";
print <<"centerbit";
<table align=center border="0" width="720" cellspacing="0" cellpadding="0" height="100%" id="table1">
<tr bgcolor=#0D0657 height=100>
<td align=center><b>
<font face="Arial" color="#FFFFFF" size="7">Company Name</font></b></p>
<p align="center">
<font face="Arial" color="#FFFFFF">What they do</font></td>
</tr>
<tr>
<td><br><br><b>
<font face="Arial" color="#0D0657">Previous Work<br></font></b>
<table border="0" width="100%" id="table2">
<tr>
centerbit
# Set up the Photos
$c = $#count;
$z = 0;
$y = 1;
while ($z < $c+1){
$nam = @count[$z];
$photo = substr($nam, 0, - 1).1;
$var = substr($nam, 0, - 1);
$nr = @count[$z+1];
print "<td valign=top width=50% align=center><p><b><font face='Arial' size='2' color='#0D0657'>$nam</font></b></p>\n";
print "<img src=\"../images/Photos/$nam/$photo.jpg\" name=\"$nam\" height=\"250\"";
print "onmouseover=\"this.height=400\" onmouseout=\"this.height=250\">\n";
print "</td><td> </td>\n";
if ($y == 2){
print "</tr><tr><td colspan=2> </td></tr><tr>\n";
$y=0;
}#end if
$z+=2;
$y++;
}#end while
print "</tr><tr><td colspan=2> </td></tr>\n";
#Do the slide script
$z = 0;
while ($z < $c+1){
$nam = @count[$z];
$pic = substr($nam, 0, -1);
$var = substr($nam, 0, 4); # gives first 4 of photo name
$cou = @count[$z+1];
print "<script>\n";
print "<!--\n";
print "//variable that will increment through the images\n";
print "var $var=1\n";
print "function slide$var() {\n";
print "//if browser does not support the image object, exit.\n";
print "if (!document.images)\n";
print "return\n";
print "document.images.$nam.src=eval(\"$pic\"+$var+\".src\")\n";
print "if ($var<$cou)\n";
print "$var++\n";
print "else\n";
print "$var=1\n";
print "//call function \"slideit()\" every 5 seconds\n";
print "setTimeout(\"slide$var()\",5000)\n";
print "}\n";
print "slide$var()\n";
print "</script>\n";
$z+=2;
}#end while
print <<"botbit";
<tr bgcolor=#0D0657 height=100>
<td align=center colspan=3><b>
<font color="#FFFFFF" face="Arial">HONESTY IS OUR POLICY</font></b><br>
<br>
<b><font face="Arial" color="#FFFFFF" size="2"><a href="index.htm">
<font color="#FFFFFF">HOME</font></a> <a href="gallery.pl">
<font color="#FFFFFF">GALLERY</font></a> <a href="testimonial.htm">
<font color="#FFFFFF">TESTIMONIALS</font></a></font></b></p>
<p align="center">
<font face="Arial" size="2" color="#FFFFFF">Contact
them :
T: Telephone Number(s)
M: Mobile Number(s)
E:
<a href="mailto:contact@companyname?subject=Contact from Website">
<font color="#FFFFFF">contact\@companyname</font></a></font></td>
</tr>
</table>
</body>
</html>
botbit