안녕라는 이미지글롭 기능 출력은 모든 파일
<?php
//Path to folder which contains images
$dirname = $_POST['dir'];
//Use glob function to get the files
//Note that we have used " * " inside this function. If you want to get only JPEG or PNG use
//below line and commnent $images variable currently in use
$images = glob($dirname."*");
//Display image using foreach loop
foreach($images as $image) {
//print the image to browser with anchor tag (Use if you want really :))
echo '<p><img style="height:176px; width:221px; float:right;" src="'.$image.'" /></p>';
}
?>
파일에서 출력 이미지에이 코드를 사용하고는
나는 image.php라고 나는 사용자가 디렉토리
을 선택하려면이 양식을 사용<form method="POST" action="image.php">
<input type="text" name="dir" placeholder="choose directory" />
<input type="submit" value="choose" />
</form>
코드를 실행할 때 폴더에있는 모든 파일을 출력합니다. test.php와 같은 파일과 js 및 css 파일 및 이미지라는 이미지가있는 파일은 js 및 css 및 all .php 출력을 실행할 때 발생합니다. 파일에 이미지가 출력되지 않습니다. 오류 :
가능한 중복 http://stackoverflow.com/questions/19543136/php -foreach-and-glob-function) –