created Re: webpage auto-gallery?
on 09-28-2007 01:05 PM
<font class="small">Code:</font><hr /><pre>
<?php
//for every file in IMG_DIR, export to txt and load up thumbnail
$IMG_DIR = "thumbs/female/";
$LINK_URL = "female/";
$eTxt=file('female.txt');
//$files = (scandir($LINK_URL));
$currentDir = "female";
$currentFile = fopen("female.txt", "w+");
if ($handle = opendir($currentDir)) {
while (false !== ($file = readdir($handle))) {
if ($file != "." && $file != "..") {
fwrite($currentFile, "$file\n");
}
}
closedir($handle);
}
foreach ($eTxt as $imageName) {
?>
<a href="<?php echo $LINK_URL,$imageName ?>"><img src="<?php echo $IMG_DIR,$imageName ?>" width="75" height="75" border="0" alt="<?php echo $imageName ?>"></a>
<?
}
?></pre><hr />
In this instance the thumbnail directory acts as the main bit of code to displaying images.
|