Page 1 of 1

automatically generate new pages

Posted: Thu Mar 13, 2008 12:11 am
by lenucks
i'm new to php and i was trying to make a simple script to automatically input images and thumbnail them for me. I also want the script to make a new page after the image count reaches a certain number.

Re: automatically generate new pages

Posted: Thu Mar 13, 2008 1:10 am
by Christopher
Post what you have done so far.

Re: automatically generate new pages

Posted: Thu Mar 13, 2008 3:27 am
by lenucks
here is what i've done so far. It's a bit messy but i'm still learning php. This code so far opens and reads a directory on my server then it generates the html code needed for making 100x100 thumbnails and links them to the full size image.

<?
$path = "gallery";
$dir = opendir($path);
$image = "<img src =\"";
$thumb = "width = 100, height = 100";

while($name = readdir($dir))
{
if(($name != ".") && ($name != ".."))
{
$link = "<a href=\"/gallery/$name\">$image /gallery/$name\"$thumb></a>";
echo "$link";
}
}
closedir($dir);

?>