I've done something similar (if I'm understanding you). It's a fairly simple process.
I've adapted some code I had laying around. This is very quick and dirty code and untested, but should get you started.
<?php
// Shows all files in the directory,
$newline = "<br/>";
$dir = $modx->config['base_path'].'assets/yourfiles'; // set path to files
$dir_array = array(); // main array - contains all file names in directory
// open directory and parse file list
if (is_dir($dir)) {
if ($dh = opendir($dir)) {
// iterate over file list to create full directory array
while (($filename = readdir($dh)) !== false) {
if (($filename != ".") && ($filename != "..") && ($filename != "WS_FTP.LOG")) { // skip self, parent, and ftp log
$dir_array[] = $filename; // add the filename to the array
}
}
closedir($dh); // close directory
}
natsort($dir_array); // sort in ascending order -- delete if you don't need them sorted.
// $dir_array = array_reverse($dir_array, false); // reverse array (descending) if needed.
$n = count($dir_array); // total number of files -- might want this for something
$output = "";
$output .= "<ul>"
foreach ($dir_array as $value) { // iterate through array of filenames.
$output .= '<li>'.$value.'</li>';
}
$output .='</ul>';
}
return $output;
?>
BTW, you might look at the MaxiGallery snippet if you haven't already. It does all this for you and makes for much easier and more full-featured gallery management by the users (e.g. picture order, uploading and deleting, titles, descriptions, dropshadows, masks, slideshow, etc).
Hope this helps,
Bob