We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 31902
    • 342 Posts
    While using Gallery, it's been my understanding that you first create an album, giving it a name, then calling it up on the site by adding a tag, specific to that album, such as this example, as tutorialized on this page: http://rtfm.modx.com/extras/revo/gallery :

    [[Gallery? &album=`My Album`]]
    [[GalleryAlbums? &limit=`10`]]


    The &album= part makes this code call up a specific...already existing...album. It works great, no problem there.

    However, it requires for the album to be created by a relatively code-knowledgeable person then hard-coded into the system using any one of various methods. Once there, the site user is free to administer the album.

    The question came up the other day by a client if there is a way to create albums on the fly and add them to the site easily without needing to hard-code anything. This client is, as you may imagine, used to playing with sites like Facebook, etc., where albums are easily created on the fly without much thought.

    So, is there a way to do this? Thanks.
      • 8274 ☆ A M B ☆
      • 222 Posts
      I am sure you could do it through a snippet that loads the Gallery classes, that fires a newObject('galAlbum'), configures it and then saves the object to the 'gallery_albums" table.

      Essentially all of Gallery's goodies for managing are isolated to the mgr context. That said, all that is defined in the core/components/gallery/processors/ directory.

      The tricky thing is not only do you have to create a galAlbum record in the database, but there are three other tables that need data since they all work together ('gallery_ablum_contexts', 'gallery_album_items', 'gallery_items', and 'gallery_tags').

      So, to make a front-end friendly gallery creator/manager, you would need to extend Gallery and access all those processors via PHP to get/push data.

      So to answer your question: yes it is possible to do (as is just about anything in modx), but it will require knowledge on how to work with php processors and the database.
        • 31902
        • 342 Posts
        Thanks, Jason, for the quick reply. I guess I'll just have to come up with other ideas. In this case, it's not worth the extra work.

        Again, thanks for the reply.