I have a script that displays images in a folder. It puts 1 on top of the other and I would rather it be 2-3 images wide per row. I want to do this with CSS but I don't know how? The tricky part (I think) is that each image has a <form> so that I can delete the image and I don't know if you can have more than 1 form on a row?
PHP Code:$handle=opendir("./content/uploaded/");
$sPath = "content/uploaded/";
$sPath = rtrim($sPath, '/\\');
$aFiles = array();
while (false !== ($file = readdir($handle)))
{
if (filectime($sPath . DIRECTORY_SEPARATOR . $file) <= $iSixMonthsAgo)
{
unlink($sPath . DIRECTORY_SEPARATOR . $file);
}
else
{
$aFiles[$file] = filectime($sPath . DIRECTORY_SEPARATOR . $file);
}
}
asort($aFiles);
foreach ($aFiles AS $fileName => $createTime)
{
printf('%s (created on %s)'. PHP_EOL, '<form action="' . $_SERVER["PHP_SELF"] . '" method="post" name="form1"><input type="hidden" name="filex" id="filex" value="' .$fileName . '" hidden><input type="submit" name="Delete" id="Button" value="Delete Image"></form> <a href="content/uploaded/"'.$fileName.'" target="blank">'. $fileName .'"<br><img src=./content/uploaded/' . $fileName . ' width=400></a><br><hr><br>', date('F d Y', $createTime));
}


Reply With Quote
Bookmarks