Len Whistler
10-12-2003, 07:05 AM
Below is a php code I copied from a book at the store. It should take all the .JPGs and .GIFs in a folder and create thumbnails. You then click the thumbnails for a larger picture. But I get a error message for line 27, which is the last line with ?>
I can't figure it out. Thanks
Leonard Whistler
www.stubby.ca
<?
$dirName = "images";
$dp = opendir ($dirName);
chdir ($dirName);
while ($currentFile !== false) {
$currentFile = readDir ($dp);
$theFiles [ ] = $currentFile;
}
$imageFiles = preg_grep (" /jpg$ | gif$ / ", $theFiles);
$output = " ";
foreach ($imageFiles as $currentFile) {
$output .= <<<HERE
<a href = $currentFile>
<img src = "$currentFile" height = 50 width = 50></a>
HERE;
}
$fp = fopen ("imageIndex.htm" , "w");
fputs ($fp, $output);
fclose ($fp);
print "<a href = $dirName/imageIndex.htm>images</a>\n";
?>
I can't figure it out. Thanks
Leonard Whistler
www.stubby.ca
<?
$dirName = "images";
$dp = opendir ($dirName);
chdir ($dirName);
while ($currentFile !== false) {
$currentFile = readDir ($dp);
$theFiles [ ] = $currentFile;
}
$imageFiles = preg_grep (" /jpg$ | gif$ / ", $theFiles);
$output = " ";
foreach ($imageFiles as $currentFile) {
$output .= <<<HERE
<a href = $currentFile>
<img src = "$currentFile" height = 50 width = 50></a>
HERE;
}
$fp = fopen ("imageIndex.htm" , "w");
fputs ($fp, $output);
fclose ($fp);
print "<a href = $dirName/imageIndex.htm>images</a>\n";
?>