如何从目录中的文件夹中选择图像?

问题描述:

正在使用幻灯片类似http://tympanus.net/codrops/2010/05/23/fresh-sliding-thumbnails-gallery-with-jquery-php,我想显示的文件夹中的每个图像,而不是下拉作为我努力学习PHP .....请帮如何从目录中的文件夹中选择图像?

+1

学习的东西一般涉及尝试新事物:关于你的标题"How to select images from a folder?",从这里开始。发布您迄今为止所尝试的内容,以及您遇到问题的位置。 – Bojangles 2012-08-09 07:57:15

第一:这是一个非常具体的问题。发布你的代码?你尝试了什么?

但是:问这个听起来挺喜欢“这样做对我来说”一个问题之前

<?php 

$directory = '.'; // your directory 

$files = scandir($directory); 
$images = array(); 

foreach($files as $file) 
{ 
    $attributes = getimagesize($file); 
    if($attributes) 
    { 
     array_push($images, $file); 
    } 
} 

// An array with your images 
print_r($images);