automatically generate new pages
Moderator: General Moderators
automatically generate new pages
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.
- Christopher
- Site Administrator
- Posts: 13596
- Joined: Wed Aug 25, 2004 7:54 pm
- Location: New York, NY, US
Re: automatically generate new pages
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);
?>
<?
$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);
?>