01 <?php
02
03 // the directory, where your images are stored
04 $imgdir = '/Users/lixlpixel/Pictures/pics/';
05
06 // list of file extensions you want to show
07 $allowed_types = array('png','jpg','jpeg','gif');
08
09 $dimg = opendir($imgdir);
10 while($imgfile = readdir($dimg))
11 {
12 if(in_array(strtolower(end(explode('.',$imgfile))),$allowed_types))
13 {
14 $a_img[] = $imgfile;
15 }
16 }
17
18 // sort image array
19 if(is_array($a_img)) sort($a_img);
20
21 // total image number
22 $totimg = count($a_img);
23
24 for($x = 0; $x < $totimg; $x++)
25 {
26 $size = getimagesize($imgdir.'/'.$a_img[$x]);
27
28 // do whatever
29 $halfwidth = ceil($size[0]/2);
30 $halfheight = ceil($size[1]/2);
31 echo 'name: '.$a_img[$x].' width: '.$size[0].' height: '.$size[1].'<br />';
32 }
33
34 ?>