이미지 폴더와 하위 폴더가있는 사진 갤러리를 만들고 있습니다. 모든 폴더에 HTML 파일을 넣지 않아도됩니다. 어떻게 할 수 있습니까? 여기모든 디렉토리 폴더에서 PHP와 HTML을 자동으로 실행하십시오.
<?php
$directory = "thumbs/";
$files = glob($directory."*");
$photoCount = 0;
buildStage();
function buildStage() {
global $directory, $files;
foreach($files as $file) {
if(is_dir($file)) showFolder($file);
else showPhotos($directory);
}
}
function showPhotos($imagePath) {
global $photoCount;
$imageFile = glob($imagePath."/*.*");
echo '<img src="'.$imageFile[$photoCount].'" id="thumbPic"
onmouseover="imageOver(this)"
onmouseout="imageOut(this)"
/>'."\n";
$photoCount++;
}
function showFolder($imagePath) {
$imageFile = glob($imagePath."/*.*");
echo '<a href="' .$imagePath. '<img src="'.$imageFile[1].'" id="folder"
onmouseover="imageOver(this)"
onmouseout="imageOut(this)"
onmousedown="imageDown(this)"
/>'."\n";
}
?>
그리고 내 HTML입니다 : 당신이 줄 수있는 모든 도움을
<body>
<div id="container">
<?php include 'jellybox.php'; ?>
</div>
</body>
덕분에 여기 내 PHP입니다.
왜 모든 폴더에 HTML 파일이 필요합니까? – Pitchinnate
저는 사진 갤러리 디렉토리를 만드는 방법을 찾고 있습니다. 여기 제가 지금까지있는 곳입니다. "PHP 이미지"에서 이미지를 클릭하면 폴더가 열리지 만 인덱스 파일이 없으므로 오류가 발생합니다. 이견있는 사람? – dougburnett