We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 16357
    • 27 Posts
    I’m having quite big problems with AutoGallery. I thought it should be pretty straight forward, but I’m doing something wrong and I just can’t figure it out.

    I’ve got the following snippet call:

    [!AutoGallery?itemchunk=ag&tnwidth=170&quality=50]]


    but when I run it I get a MODx Parse Error going into a nasty loop.

    The errors are as follows:

    « Execution of a query to the database failed - Field 'title' doesn't have a default value »

    « Execution of a query to the database failed - Incorrect integer value: '' for column 'user' at row 1 »


    Anyone got any idea what’s wrong?
      • 24449
      • 81 Posts
      Hi krizinbizz,

      The first problem I’m blaming on someone being to clever when they fixed my dodgy MYSQL table code. The proper way to fix it would be to download the new version of AutoGallery.inc.php that I’ve just fixed (Sorry for the constant small updates, btw!) and do a "drop table [prefix]autogallery_info" (probably "modx_autogallery_info") on your database. If you have lots of titles and things already set up you can just modify the table to allow NULL values for title and description...

      As for the second problem I can’t see a cause in the AutoGallery code, but its Sunday so I haven’t checked it thoroughly; I’ll have a proper look tomorrow. It might just start being happy when we fix the first problem...


      Ramsay
        • 24449
        • 81 Posts
        Hi KKelly,

        The folder full of jpgs needs to be in a folder within your site’s root, specifically under "assets/galleries/". The name of the sub folder is important but up to you.

        There are several ways of calling the snippet. You can call "[!AutoGallery?gallery=NAMEOFFOLDER!]". This will display the gallery with all of the default options. Alternatively you can just call "[!AutoGallery!]" and the - assuming your gallery page has the alias "gallerypage" you can go to the URL "gallerypage?gallery=NAMEOFFOLDER". Finally the simplest but least versatile is to call "[!AutoGallery!]" alone but name the folder with the page id of the gallery page.

        The second option gives the most complex site for the simplest code, since you can now have as many galleries as you like by creating more folders and linking to gallerypage with different values in the "gallery=" part of the URL. However it prevents you using different styling for different galleries (unless you write a snippet to change CSS or something based on the gallery request argument) and it prevents you having different access control for different galleries.

        Hope this helps - I know its not really step by step! See what you get from that and then let us know how it goes and what questions you have about the more advanced options.


        Ramsay
          • 16357
          • 27 Posts
          Thanks Ramsay. The updated inc took care of the looping stuff.

          After actually having read some instructions as well, everything is working like a charm. Thanks a lot smiley
            • 16004
            • 10 Posts
            Thanks for the reply. smiley

            This:



            The folder full of jpgs needs to be in a folder within your site’s root, specifically under "assets/galleries/"...

            You can call "[!AutoGallery?gallery=NAMEOFFOLDER!]". This will display the gallery with all of the default options.


            is what I tried, and in fact it generated all the thumbnails in the folder under assets/galleries/, but when I looked at the page itself there was nothing there.

            Is there anything else I need to do? Do I have to link to the thumbnails through TinyMCE? huh
              • 24449
              • 81 Posts
              Hi,

              Yes, it was - er - an - er - exercise for the reader. Yes. I didn’t just totally forget how to use my own code...

              You need to specify a chunk to be used to display the items. Create a chunk and pass its name to the snippet as "itemchunk=NAME"

              The chunk can use all the placeholders listed in the docs. As an example:

              <a href="[+imgpath+]" alt="[+title+]"><img src=[+tnpath+] /></a>


              Or a more complex one:

              <span style="padding-right:6px;"><a href="[+imgpath+]" rel="gb_pageset[NAME]"  title="[+title+]"><img src=[+tnpath+] width="180" style="border:4px solid #7e0105;" /></a>[+adminbuttons+]</span>



              Ramsay

                • 16004
                • 10 Posts
                Thanks, very cool! The page is now displaying the gallery. smiley

                Just one more thing - when clicking on a thumbnail, I would like the image to be displayed in a "lightbox" (or some other Ajax tool).

                So far, clicking on a tn opens a new window.

                Since it uses MODx chunks for display it is easy to integrate with any funky image gallery display utility (thickbox, lightbox etc) using the chunk.

                Unfortunately, not so "easy" for me. wink
                  • 24449
                  • 81 Posts
                  Hi,

                  The "more complex" example will load in greybox if you add all the greybox includes to the top of the page.

                  Most lightboxy things require you to include a few JS scripts and CSS files, then add something to the links you want to be boxed. In greybox’s case its the ’rel="gb_pageset[NAME]"’ part.
                  You will need to read the docs for your chosen box displayer though.

                  Ramsay
                    • 16004
                    • 10 Posts
                    Quote from: ramsay at Nov 09, 2009, 06:12 AM

                    Most lightboxy things require you to include a few JS scripts and CSS files

                    I used "litebox" and now (after some tinkering to get my drop down menues and ajax search in order) everything works like a charm.

                    Thanks again. smiley
                      • 23235
                      • 40 Posts
                      Is there a way that I can change my gallery to not duplicate the extensions. It looks, according to your conversation with fixedmachine, like you did this to avoid conflicts with mp3 files but I plan on only using picture files in this gallery, so that is not a problem for me. It looks like he may have come up with a solution, but I’m not sure how to implement that. Also can I make it so that the first letter in the file name is capitalized. Here is a link to the gallery I am working on.
                      http://www.yoursivet.com/pet-pics.php
                      As you can see I list the pets name below the picture by using [+filename+] and it would be nice to not have the names without the extension.
                      By the way, this is a great add-on. Thanks for all of your work on it.