We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 13373
    • 70 Posts
    Thanks for this - it’s made one of my galleries much faster.

    I just replaced the [+thumbnail+] placeholder in the galItemThumb chunk with that code, and all is good smiley

    Cheers,
    Jacob
      • 9710
      • 24 Posts
      Does anyone know how to use phpthumbof with the gallerific plugin?

      It’s working for the little images used as preview, but I’ve no idea how to use it for the big main pictures itself..
        • 37242 ☆ A M B ☆
        • 339 Posts
        I like the irony in that splittingred did gallery AND the solution, phpthumbof laugh
          • 6038
          • 228 Posts
          I also found that the caching creates files in /core/cache/phpthumbof folder for gallery items, but they are never used.
          Thanks for this tip!

          Did we arrive at an answer yet?
          Are we all doing something wrong, or is this a bug?
            • 7806
            • 45 Posts
            Quote from: crunch at Mar 20, 2011, 06:43 PM

            I also found that the caching creates files in /core/cache/phpthumbof folder for gallery items, but they are never used.
            Thanks for this tip!

            Did we arrive at an answer yet?
            Are we all doing something wrong, or is this a bug?

            I have filed a bug report on github: https://github.com/splittingred/Gallery/issues/70. Splittingred looked into it and wrote:


            Ok, so it’s definitely caching files; the URL might be the connector.php file, but it’s outputting from that, and loading the file from cache within that file. phpThumbOf works differently; it stores cache files on the local server (this is not optimal for Gallery, due to the way galleries work).

            So I can confirm caching works on Gallery. Closing ticket. If you’re still having issues, check to make sure your PHP install has ImageMagick enabled.

            ImageMagick is installed. But I definitly see a difference in performance when gallery is used with or without separate phpthumb. Care for an example?

            Plain gallery: http://modx2.frischnetz.de/
            phpThumbOf Gallery: http://modx2.frischnetz.de/23.html

            (make sure to press shift when reloading so that the browser cannot pull the files from its own cache.)

            Jörg
              • 16337
              • 44 Posts
              thats a pity gallery can’t use files directly.

              the difference:

              with bare gallery:

              <img class="" src="/assets/components/gallery/connector.php?action=web/phpthumb&amp;w=100&amp;h=100&amp;zc=1&amp;far=C&amp;q=90&amp;src=http%3A%2F%2Fmodx2.frischnetz.de%2Fassets%2Fcomponents%2Fgallery%2Ffiles%2F3%2F44.jpg" alt="img_9717.jpg">

              with phpthumbof:

              <img class="" src="/assets/components/phpthumbof/cache/_assets_components_gallery_files_3_44.jpg.05dda00f0de4d0a2611fe64d7fcf77f6.png" alt="img_9717.jpg">

              of course there is a HUGE difference. in case of phpthumbof the webserver serves the static file directly and this gives the performance you would expect from "cache". The bare gallery does a PHP request and depending on how well your php is configured eg, as a module or standalone, webserver config etc. it could be anywhere between OK to slow in terms of performance. it does not matter if PHP requests the static file from cache via or not (OK, well it makes it a lot faster than calling imagemagick every time of course...) it is still running PHP and it will always be a lot slower than calling a static file directly. And with the fast proxy front ends like nginx the static files are served at a blistering speed.

              So phpthumbof it is for me anyway...

              I haven’t studied the code properly but I dont like the phpthumb&w=100&h=100&zc=1 in the url either - size should be already predetermined if it is cached no? is there another dynamic sizing operation going on or something...

              and another big problem is that browsers don’t cache dynamic link like gallery outputs for thumbnails. so every time you reload the page it requests the thumbnails from the server - talking of bringing servers to their knees.

              I wish I had time to look into more detail right now..
                • 7806
                • 45 Posts
                OK, now I understand a little more. So the files are indeed cached, but still served by a script, instead of linked directly. Good to know. It’s not as worse as directly resizing them, but can still cause timeouts on slower servers or cheap webhosting.

                Would be great if the phpthumbof-way could somehow be hardwired into gallery’s gearbox...

                Thanks!
                Jörg
                  • 8442
                  • 48 Posts
                  Quote from: TasDeveloper at Mar 08, 2011, 12:02 AM

                  Thanks for this - it’s made one of my galleries much faster.

                  I just replaced the [+thumbnail+] placeholder in the galItemThumb chunk with that code, and all is good smiley

                  Cheers,
                  Jacob

                  This seems to speed up the loading time of gallery dramatically however when your images are different dimensions it squashes them rather than how [[+thumbnail]] resizes them. Anyway round this? At the moment Gallery is really really slow...
                    • 34022 ☆ A M B ☆
                    • 91 Posts
                    I don’t experience the "squashing" problem with the phpthumb method. Make sure you don’t have width and height automatically set for the images: e.g. don’t do

                    <img src="phpthumbcode" width="400" height="300" />


                    If that’s not the problem, can you paste your gallery template code and/ or the generated URL? You can also add zoomcropping: http://rtfm.modx.com/display/ADDON/phpThumbOf
                      WebsiteZen.com - MODX and E-Commerce web development in the San Francisco Bay Area
                      • 8442
                      • 48 Posts
                      Ah i think I have the width and height set in the HTML, i’ll double check but reckon thats the issue. Thanks