We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 5594
    • 4 Posts
    So since you already helped me get MaxiGallery running, no good deed goes unpunished, now I have more questions!

    I am uploading a few hundred pictures at a time (and hope to do this for a long time in the future)

    The file names are named according to yyyy-mm-dd-hh and that is the only thing important to me, is there a way to have the filename automatically fed into the description so that I don’t have to go through and type a few hundred descriptions?

    I have a feeling this is not included by default in any manner, but maybe you can point me to the area in the script where this could be added (i think probably easily)

    Thanks again!
    john
      • 5594
      • 4 Posts
      I edited maxigallery.class.php to make this work - tho not ideal as it forces any new gallery to do this (tho its really not so bad for my purposes)

      line 405:
      $rs1=$modx->db->query("INSERT INTO " . $pics_tbl . "(id, gal_id, filename, title, date, own_id) VALUES(NULL,’" . $gal_id . "’,’" . $name . "’,’" . substr(strtolower($name),0,-4) . "’," . $pic_date . ,’".$modx->getLoginUserID()."’)");
      }else{$rs1=$modx->db->query("INSERT INTO " . $pics_tbl . "(id, gal_id, filename, title, date) VALUES(NULL,’" . $gal_id . "’,’" . $name . "’,’" .substr(strtolower($name), 0, -4) . "’," . $pic_date . ")");

      this works, but I wonder if there is something I can do with templates, so if the picture.title is null, it will substitute the filename...?

      john

      PS -

      is there a way to delete an entire gallery at once, since I am dealing with 1000 pictures if something goes wrong, i dont want to manually remove them all.

      do I have to just delete the id# folder under galleries then drop the values for that id in the database? just wondering if there is a quicker cleaner way.

      john
        • 7923
        • 4,213 Posts
        Quote from: codezero at Dec 14, 2006, 12:17 AM

        this works, but I wonder if there is something I can do with templates, so if the picture.title is null, it will substitute the filename...?
        Great that you got it solved, here’s how to do it with templates. If you want to show the filename as description when description is empty, use this in the template:
        [+maxigallery.picture.descr:is=``:then=`
                  [+maxigallery.picture.filename:striptype+]
        `+]
        

        Then create a snippet by the name "phx:striptype" with the following contents:
        <?php
        return substr($output, 0, strrpos($output, ".") - 1); 
        ?>
        

        So that will create a phx custom modifier "striptype" what should strip the file type suffix from a string.


        is there a way to delete an entire gallery at once, since I am dealing with 1000 pictures if something goes wrong, i dont want to manually remove them all.

        do I have to just delete the id# folder under galleries then drop the values for that id in the database? just wondering if there is a quicker cleaner way.
        Currently you need to do that manually like you said, I’ll make a button for this in the next version. Thanks for the suggestion!


          "He can have a lollipop any time he wants to. That's what it means to be a programmer."