1 Reply Latest reply on Nov 13, 2006 4:06 AM by chris.huston.t10

    Can you build this?

      I've got a CSS wrapper for my new photography site, and I was going to use Simpleviewer and Porta as my gallery, but a friend of mine has opened my eyes to the magic of Flex. I am a photographer and designer, not a web programmer, so I am looking for one of you gurus to help me out.

      I've got a ton of photo galleries in a php app called Blorp, and I want to move everything to a Flex-based package. I'd love to not have to create XML files for every directory. I'm sure it's a snap to make a photo gallery in Flex, but can you build one that automatically propagates the information based on the directory and filename of the image?

      For example, I put a folder called "auggie pics" in the "Gallery" folder, with a picture called "dognose.jpg" - the Flex interface app would create the gallery, name that particular gallery "auggie pics" and display the caption "dognose" under that image.

      Is this possible? If not, I have an app that will create XML files based on folders of images that we could use as a basis for each gallery folder (the XML files would have to be edited a bit). I have a design (it's very simple) all sketched out, and Flex Builder 2.

      Please let me know if you can help me out! If it's really gonna take a lot of time to do, I'll gladly pay you. Thanks! Here's my email.
        • 1. Re: Can you build this?
          chris.huston.t10 Level 3
          If you can use PHP, then you can have PHP return a list of all the jpg files in a folder. You could then use this list to display the photos in Flex. Depending upon how many bells and whistles you want in your gallery interface, it is a fairly simple task to do.

          Here is the PHP script to get the file list, including sub-directories, if you want:

          function file_lister($dir_name,$sub_dir,$max_depth = 10,$depth = 0) {
          if ($depth >= $max_depth) {
          error_log("Reached max depth $max_depth in $dir_name.");
          return false;
          $subdirectories = array();
          $files = array();
          if (is_dir($dir_name.$sub_dir) && is_readable($dir_name.$sub_dir)) {
          $d = dir($dir_name.$sub_dir);
          while (false !== ($f = $d->read())) {
          // skip . and ..
          if (('.' == $f) || ('..' == $f)) {
          if (is_dir($dir_name.$sub_dir."/".$f)) {
          } else if (exif_imagetype($dir_name.$sub_dir."/".$f)){
          $sub_dev = "";
          if ($sub_dir!="") {
          $sub_dev = "/";
          foreach ($subdirectories as $subdirectory) {
          $files = array_merge($files,file_lister($dir_name,$subdirectory,$max_depth,$depth+1));
          return $files;

          $img_path = $_POST[img_path];
          $files = file_lister($img_path, '');
          $img_list = "<images>";
          foreach ($files as $file) {
          $img_list .= "<image>$file</image>";
          $img_list .= "</images>";
          echo "$img_list";

          Is this what you were looking for, or did you not want to use PHP at all?