We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 8109
    • 128 Posts
    Quick note for anyone who might stuggle to get phpThumb working with MaxiGallery. This note assumes you have followed the instructions for installing the phx:phpThumb snippit.

    To get the phx:phpThumb snippit to work in maxigallery, I found that the call, rather than being in [+plus brackets+] as indicated in the documentation, must be in [*asterisk_brackets*]. (I’d love for someone to explain why this is.)

    So, if you create a chunk for themaxigallery &galleryPictureTpl parameter (easiest to copy the default html file from the maxigallery templates directory), you just need to modify the <img src> tag. The default looks like this:

    <img src="[(base_url)][+maxigallery.path_to_gal+]tn_[+maxigallery.picture.filename+]" class="thumbnail" title="[+maxigallery.picture.title:htmlent+] [+maxigallery.strings.click_to_zoom+]" alt="[+maxigallery.picture.title:htmlent+] [+maxigallery.strings.click_to_zoom+]" />


    Now change the code between the quotation marks thusly:

    <img src="[*myimage:phpthumb=`h=100&w=100&zc=1#[+maxigallery.path_to_gal+][+maxigallery.picture.filename+]#1`*]" class="thumbnail" title="[+maxigallery.picture.title:htmlent+] [+maxigallery.strings.click_to_zoom+]" alt="[+maxigallery.picture.title:htmlent+] [+maxigallery.strings.click_to_zoom+]" />


    This example will resize all the gallery thumbnails to 100px squares (zc stands for zoom crop and the value 1 causes the image to be cropped on center)]. You can read the phpthumb ducmentation that comes with the phx:thumb distribution for a complete set of options, but this will get you nice square thumbnails if that’s what you’re after. [Note, don’t apply phpthumb to the MG thumbnail file prefixed with "th_", apply it to the original file.]

    SYNTAX NOTE
    Since maxigallery doesn’t have a placeholder for the filename or complete path to the thumbnail file, we use the following syntax for the image source:

    [*myimage:phphthumb=`phpthumb_options#path_to_image#1`*]

    That "#1" at the end seems to be required. It is called the "mode switch" variable, and I can’t explain it’s function.

      Revo 2.0.8-pl
      • 20413
      • 2,877 Posts
      Check out ---> http://wiki.modxcms.com/index.php/MaxiGallery

      You can do this without PHx. E.g. &max_pic_size=`800` &max_thumb_size=`70` (width)
        @hawproductions | http://mrhaw.com/

        Infograph: MODX Advanced Install in 7 steps:
        http://forums.modx.com/thread/96954/infograph-modx-advanced-install-in-7-steps

        Recap: Portland, OR (PDX) MODX CMS Meetup, Oct 6, 2015. US Bancorp Tower
        http://mrhaw.com/modx_portland_oregon_pdx_modx_cms_meetup_oct_2015_us_bancorp_tower
        • 7923
        • 4,213 Posts
        No, phpThumb is required to get square thumbnails for example.. MaxiGallery doesn’t do image cropping.

        phpThumb can also do much that MaxiGallery is not able to do.. so I’m all for using phpThumb with MaxiGallery. And one thing that you get in this process is that if you want to resize something again, just change phpThumb parameters. You don’t have to re-upload everything. And same goes if you want to change some picture, just replace the original in filesystem via ftp and phpThumb creates all the various picture sizes on it on first request of the pic.

        It’s very nice! smiley


          "He can have a lollipop any time he wants to. That's what it means to be a programmer."
          • 20413
          • 2,877 Posts
          I get nice thumbs (with shadows), sweet pics 800x600 and also I get to save the big original in folder when I upload images!
          This must be done by phpthumb built in somewhere in the process or what?  tongue

          ....don’t have to re-upload everything.

          Gotcha! I have missunderstood it! These are 2 different things!? Thanks for clarifying!!
            @hawproductions | http://mrhaw.com/

            Infograph: MODX Advanced Install in 7 steps:
            http://forums.modx.com/thread/96954/infograph-modx-advanced-install-in-7-steps

            Recap: Portland, OR (PDX) MODX CMS Meetup, Oct 6, 2015. US Bancorp Tower
            http://mrhaw.com/modx_portland_oregon_pdx_modx_cms_meetup_oct_2015_us_bancorp_tower
            • 8109
            • 128 Posts


            Doze. I can see now why rebuilding Maxigalley to take advantage of phpthumb is a good idea. You could, for example, upload your "big" images, have php thumb create the normal and thumb files on the fly and cache them for future use, and all image resizing, as you say, would then be available in the MG call. I am currently creating all thumbnails at 200x200px, though I suppose I could avoid the use of the thumbnails generated by MG altogether by removing the thumbnail image file prefix in the above example. Then, if I wanted to create thumbnails larger than those stored in the MG directories, I could use phpthumb and get "thumbnails" up to the size of the original image (and beyond). Anyway, much more flexible.

            Thanks!
              Revo 2.0.8-pl
              • 17282
              • 283 Posts
              I have this working (W00t!) BUT .. the image quality is REALLY poor .. i have q=95 set ... its really pixelated .. can anyone help please?


              thanks
              martyn
                Everytime you use Flash ... a puppy dies .....
                R.G Taylor
                • 17282
                • 283 Posts
                using GD2 by the way
                  Everytime you use Flash ... a puppy dies .....
                  R.G Taylor
                  • 8109
                  • 128 Posts
                  You may want to make sure you are applying phpTHumb to the original or Big image, and not to the MaxiGallery thumbnail. You may inadvertently be upsizing a thumbnail created by MG, or running the jpeg compression to an already heavily compressed image, either of which may result in pixelation or low quality.

                  Ideally MG would store only one version of a file (your original) and allow phpThumb to handle all subsequent resizing. It might be fun to figure out how!
                    Revo 2.0.8-pl
                  • This is an excellent addition to maxigallery. I think it should be included in the Wiki.

                    Cheers,
                      • 7923
                      • 4,213 Posts
                      Yes, I think so too.. could you add it, thanks! smiley


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