# Php file to build list from dir for gallery.swf

**URL:** <https://forum.kirupa.com/t/php-file-to-build-list-from-dir-for-gallery-swf/207342>\
**Category:** Uncategorized\
**Created:** [November 16, 2006, 5:14pm UTC](https://forum.kirupa.com/t/php-file-to-build-list-from-dir-for-gallery-swf/207342 "2006-11-16T17:14:26Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![jacob](https://avatars.discourse-cdn.com/v4/letter/j/f1d935/32.png) [@jacob](https://forum.kirupa.com/u/jacob)\
**Post date:** [November 16, 2006, 5:14pm UTC](https://forum.kirupa.com/t/php-file-to-build-list-from-dir-for-gallery-swf/207342/1 "2006-11-16T17:14:26Z")

</div>

I got someone’s code and am trying to get it to work a little differently.

I want it to look at a dir, specified by a variable. This php will be called by a link like

gallerylist.php?project1

where project1 is the folder the gallerylist.php should look

the gallerylist.php will need to make a list of files and then play the gallery.swf file.

the files will be jpgs and flvs (which I am having trouble getting functional)

here is what I have so far for the gallerylist.php:

\<?php

$selection=$\_GET[‘location’];

/\*  
XML list generator cobbled together by: Åñüßï§  
\*/  
//------------------Edit some Variables----------------------------------  
//You can put a link in the quotes below, All pictures will link to this.  
//$lynk = “”;  
$dirpath = “[http://aaronglazer.com](http://aaronglazer.com)”;// the directory this file is in under jpg rotator

//------------------Dont need to edit things below-----------------------

//------------------Now to do the work-----------------------------------  
// read through the directory and filter files to an array  
//-----------------------------------------------------------------------  
$location = “.”;  
$filter = “.jpg”;  
@$d = dir($location);  
if ($d) {  
while($entry=$d-\>read()) {  
$ps = strpos(strtolower($entry), $filter);  
if (!($ps === false)) {  
$items[] = $entry;  
}  
}  
$d-\>close();  
sort($items);  
}  
//------------------Print Everything to XML Now-------------------------  
header(“content-type:text/xml;charset=utf-8”);  
echo "\<?xml version=‘1.0’?\>  
";

// I’M NOT SURE WHAT TO PUT HERE-----  
// THIS SCRIPT NEEDS TO BUILD LIST OF BOTH JPGS AND MOVIES BASED ON CONTENT  
// THEY ALL WILL HAVE FORWARD AND BACK BUTTONS,  
// BUT THE FLV WILL HAVE TO HAVE A CLEAROVERSEEK CONTROLLER (which is not visible when it is a jpg)

echo " \<image\>  
"; ///THIS DOESN’T SEEM CORRECT

//---------------------------loop---------------------------------------  
for($i=0; $i\<sizeof($items); $i++) {

echo “\<photo path=’$dirpath$items[$i]’ link=’$lynk’ /\>”;

}

//closing tags  
echo " \</image\>  
";

?\>

So I also need to make the gallery.swf, and i believe I will have to have the code in actionscript handle the decision whether or not the file is a jpg or flv, and whether of not to have the clearoverseek.swf controller or not

I would really appreciate help getting this wrapped up.

this is the site as it is now : [aaronglazer.com/index2.php](http://aaronglazer.com/index2.php)
