We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 17282
    • 283 Posts
    Hehe Cheers Gryzor on the new design, its far from finished yet, I didnt like the old one much either, I preffered the one before it. However, got to busy to do anything with it etc....

    Im gonna write the tutorials anyway, so keep yer eyes peeled smiley

    M
      Everytime you use Flash ... a puppy dies .....
      R.G Taylor
      • 11418
      • 45 Posts
      Yeah, good work. I’ve just done the design of my website too (i’m new in the business)

      Did I give you the idea for the tutorial or what ?
        • 17282
        • 283 Posts
        Actually it was the fact that several people have been commenting on a lack of understandable documentation for AutoGallery that decided me too do it, Ramsay’s instructions are great, but can be a bit difficult to follow if (like me) you are technically retarded smiley

        So i thought, well, if I go through and set up AutoGallery myself in its various formats, and write a step by step on how I did it (minus all the cussing and ringing Ramsay to ask why I couldn’t get this bit or that bit to work) it would probably be of a help to those of us less Code minded smiley


        M

          Everytime you use Flash ... a puppy dies .....
          R.G Taylor
          • 23235
          • 40 Posts
          If you are taking tutorial requests I’d like to see one on setting pagination and pagination navigation. I love this snippet but have had a heck of a time getting pagination to work. I’ve talked to Ramsay about this but we couldn’t figure out what I was doing wrong (or not doing).
            • 8367
            • 1 Posts
            Hi,

            First of all thanks a million for this resource. It will benefit me greatly in putting up new content for my site.

            One query: I was wondering if there is any way to influence where the cropping of portrait photos is oriented from. At the moment the thumbnail is generated from a sample somewhere in the middle of the image but sometimes when cropping a portrait image of, for example, a full length body shot, the head will be cropped from the thumbnail.

            I have taken a look at the generate_tn function in the PHP but can’t really get my head around how this y-origin can be changed.

            Thanks again!

            Eamonn
              • 24449
              • 81 Posts
              Hi,

              Just so everyone knows: cleaning up the code for AG is very high on my list of things to do when I have some free time since I’m not even sure if I can find how to change things like this wink

              The short answer is that you can’t change the y-origin with any parameters. The longer answer is to look at the generateTN function in the inc.php file. My version is now a little different from the published one so I can’t give helpful line numbers but there are two lines like:

                    imagecopy($targetimg, $shrunk, 0, 0, $snipsize, 0, $tnwidth, $tnheight);
              


              These generate the tn and use the $snipsize variable to determine how much gets cut off. The first two args are the dest and source image, then the x,y of the origin in the DEST image, then the origin in the SOURCE image, then the width and height.

              Assuming you wanted to always keep the top of the image and remove the bottom you might want to just replace the $snipsize with 0 to set the origin to the top, unless its the bottom left - I really cant remember! If that gives you just the bottom part you could use ($snipsize * 2), since $snipsize is defined as half the amount to be cropped.

              There are two blocks there, one is for cropping width, one for cropping height. I’m sure you’ll figure it out but let me know how it goes!

              Ramsay
                • 2318
                • 7 Posts
                I’ve installed the autogallery package, and it’s working great. I’m now trying to install the webside management interface so I can let my users upload photos to their galleries. I have it mostly done, but I’m stuck where the AddGalButton snippet calls "window.location=’addgalitem?".

                Obviously addgalitem is a page, but there is no reference to what the page contents are. I’d guess it’s an file upload/name/description form with a call to another snippet, but what the details are I don’t know.

                Does anyone else have this working and be able to send me a copy of the code?

                Thanks, glen.
                  • 24449
                  • 81 Posts
                  Hi,

                  Sorry, I got caught up in work and failed to reply to your email... As soon as I find a copy I’ll stick it on our server and make a mention of it on here in case you aren’t the only person who has noticed it’s absence!

                  Ramsay
                    • 24449
                    • 81 Posts
                    Hi guys,

                    Ok, I really can’t find the original AddGalItem ANYWHERE so I have done you something that should solve the problem:

                    Hopefully your Add an Image button goes to a page and includes ?gallery=blah in the URL…

                    If you make the page a form that looks a bit like this (but prettier smiley )

                    <form action="autogal-additem" enctype="multipart/form-data" method="post">
                    <input name="action" type="hidden" value="addimage" />
                    <input name="gallery" type="hidden" value="[!getter?arg=gallery!]" />
                    <table border="0">
                    <tbody>
                    <tr>
                    <td><strong>Title: </strong></td>
                    <td><input name="title" type="text" /></td>
                    </tr>
                    <tr>
                    <td><strong>Comment: </strong></td>
                    <td><input name="comment" type="text" /></td>
                    </tr>
                    <tr>
                    <td><strong>Gallery image:</strong></td>
                    <td><input name="image" type="file" /></td>
                    </tr>
                    </tbody>
                    </table>
                    <input type="submit" />
                    </form>
                    


                    then you can make another page with the alias autogal-additem and just a single snippet call to this snippet:

                    <?php
                      if($_FILES['image']['size'] <= 0) {
                        return '<script type="text/javascript">alert("You forgot to upload an image!"); history.go(-1);</script>';
                      }
                      $name = $modx->db->escape($_FILES['image']['name']);
                      move_uploaded_file($_FILES['image']['tmp_name'], MODX_BASE_PATH . '/assets/galleries/' . $gallery . '/' . $name);
                      $fields['title'] = $modx->db->escape($_REQUEST['title']);
                      $fields['description'] = $modx->db->escape($_REQUEST['description']);
                      $gallery = $modx->db->escape($_REQUEST['gallery']);
                      $res = $modx->db->select('*', $modx->db->config['table_prefix'] . 'autogallery_info', 'gallery="' . $gallery . '" AND entity="' . $name . '"');
                      if($modx->db->getRecordCount($res) > 0) {
                        $modx->db->update($fields,  $modx->db->config['table_prefix'] . 'autogallery_info', 'gallery="' . $gallery . '" AND entity="' . $name . '"');  
                      } else {
                        $fields['gallery'] = $modx->db->escape($_REQUEST['gallery']);
                        $fields['entity'] = $modx->db->escape($_FILES['image']['name']);
                        $modx->db->insert($fields,  $modx->db->config['table_prefix'] . 'autogallery_info');
                      }
                    ?>
                    



                    I hope this is enough to get you going. Let me know how it goes.


                    Ramsay
                      • 36820
                      • 31 Posts
                      I got all the thumbs created by AG but now there should be title and description added.

                      I have spent a whole day but that form does not even show up. I just can not get that GalAdminButtons chunk to show up.

                      {{GalAdminButtons}} looks like this
                      <input type="button" value="Modify" onclick="window.location='modgalitem?entity=[+filename+]&gallery=[+gallery+]';" /><input type="button" value="Delete" onclick="window.location='AutoGalMod?backto=gallerypage%3Fgallery%3D[+gallery+]&entity=[+filename+]&gallery=[+gallery+]&action=Del';" />


                      my snippet call is:
                      [!AutoGallery?itemchunk=`autoGalleryItem` &tnwidth=`170` &tnheight=`210` &quality=`100` &adminbuttons=`GalAdminButtons` &admingroups=`admins`!][!MemberCheck?groups=`admins` &chunk=`GalAddButton`!]


                      I have not added any manageruser or webuser so far as I first just would like to get it running for Administrator.

                      At the moment the page only shows all the thumbs nothing else.
                      I have tried a lot of different combinations but I cant get it running.