a 有一个网站,目录中有 400 多张图片。我想在每页上按 12 列出它们。我怎样才能做到这一点?这是我的实际代码:
<!doctype html>
<html lang="hu">
<head>
<title>Amatőr</title>
<meta charset="utf-8"/>
</head>
<body>
<h2><a href="../php/upload_picture.php" style="font-size:15pt; color:#ff00e8; text-decoration: none;">Vannak jó képeid? Töltsd fel őket és kikerülhetnek az oldalra!</a></h2>
<article>
<header>
Amatőr Lányok
</header>
<div id="kepek">
<?php
$imgdir = '../img/blog/img/amator/'; //Pick your folder
$allowed_types = array('png','jpg','jpeg','gif'); //Allowed types of files
$dimg = opendir($imgdir);//Open directory
while($imgfile = readdir($dimg))
{
if( in_array(strtolower(substr($imgfile,-3)),$allowed_types) OR
in_array(strtolower(substr($imgfile,-4)),$allowed_types) )
/*If the file is an image add it to the array*/
{$a_img[] = $imgfile;}
}
$totimg = count($a_img); //The total count of all the images
//Echo out the images and their paths incased in an li.
for($x=0; $x < $totimg; $x++){ echo "<a onclick='Lightbox.start(this, false, false, false, false); return false;' rel='lightbox[amator]' href='" . $imgdir . $a_img[$x] . "'><img class='kep_listaz' width='200px' height='160px' src='" . $imgdir . $a_img[$x] . "' /></a>";}
?>
</div>
</article>
</body>
</html>
Thanks!