Hi All,
Can anyone give me some hints on how I can separate the array of images that is produced by the code below. I want to be able to control the spacing between images, the amount of columns and allow for more than one page if there are too many images in the array. I am also interested in created a new field in my database called a type field and that way I would be able to sort items in the array such as a category for cats a category for dogs a category for fish. So that if someone only wanted to view fish they could pull only the fish from the array instead of mandating everything in the array. If anyone could help me out with any of these aspects your help would be greatly appreciated.
<?php
$imageDir = "image_gallery/"; # Location of small versions
$big = "big/"; # Location of big versions (assumed to be a subdir of above)
$text = "text.txt";
$fh=fopen($text, "rb");
while(!feof($fh)) {
$line = fgets($fh);
$image[] = explode(",", $line);
}
echo <<<HTML
<style type="text/css">
.floated {font-family:Verdana, Arial, Helvetica, sans-serif; font-size:9px; color:#000066; margin: 2px; width:100px; height: 150px; background-color:#FEF8E2; float:left; text-align:center;}
</style>
HTML;
foreach ($image as $image){
if (file_exists($imageDir.$image[0])){
echo <<<HTML
<div class="floated">
<a href="{$imageDir}{$big}{$image[0]}">
<img src="{$imageDir}{$image[0]}">
</a><br/>
{$image[1]}
</div>
HTML;
} //end the internal if
} //end the foreach
?>
Can anyone give me some hints on how I can separate the array of images that is produced by the code below. I want to be able to control the spacing between images, the amount of columns and allow for more than one page if there are too many images in the array. I am also interested in created a new field in my database called a type field and that way I would be able to sort items in the array such as a category for cats a category for dogs a category for fish. So that if someone only wanted to view fish they could pull only the fish from the array instead of mandating everything in the array. If anyone could help me out with any of these aspects your help would be greatly appreciated.
<?php
$imageDir = "image_gallery/"; # Location of small versions
$big = "big/"; # Location of big versions (assumed to be a subdir of above)
$text = "text.txt";
$fh=fopen($text, "rb");
while(!feof($fh)) {
$line = fgets($fh);
$image[] = explode(",", $line);
}
echo <<<HTML
<style type="text/css">
.floated {font-family:Verdana, Arial, Helvetica, sans-serif; font-size:9px; color:#000066; margin: 2px; width:100px; height: 150px; background-color:#FEF8E2; float:left; text-align:center;}
</style>
HTML;
foreach ($image as $image){
if (file_exists($imageDir.$image[0])){
echo <<<HTML
<div class="floated">
<a href="{$imageDir}{$big}{$image[0]}">
<img src="{$imageDir}{$image[0]}">
</a><br/>
{$image[1]}
</div>
HTML;
} //end the internal if
} //end the foreach
?>