We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 13218
    • 134 Posts
    Hi.
    phpThumbOf seems to have a problem with a site with thousands of thumbs.

    I have a navigation containing 50 thumbs. When the phpThumbOf cache folder is empty, it takes a few seconds to generate it, as expected.

    But when all images of the site are in that cache folder, about 6500, i get script-timeouts for the navigation, even though the navigations thumbs are already in that cache.

    Any thoughts?
      @itWilllBeOK
      • 38290
      • 712 Posts
      phpthumbof is not scalable. This is described in more detail here
      http://www.darkstardesign.com/resources/phpthumbsup/

      I would recommend switching to phpthumbsup
        jpdevries
      • Yes, I imagine phpThumbOf would choke on that.
        You might try pThumb instead. It would be considerably more efficient for your use case. My guess is the difference would be enough to eliminate your problem.
        Just uninstall phpThumbOf, install pThumb and see how things work; you don't need to change any of your site's coding.

        Of course, 50 images per page for the navigation is a lot of HTTP requests. You might consider consolidating them into a sprite them if that's a possibility.
          Extras :: pThumbResizerimageSlimsetPlaceholders
        • The problems with phpThumbOf in this scenario are:

          1. It's creating a new set of 50 thumbnails for each page, even if the images are exactly the same from one page to another. That's why your cache has 6500 images in it. As you might imagine this really interferes with browser caching, not to mention generating lots of extra work for the server.
          2. Every time it runs—50 times per page—it attempts to clean its cache. Because of another bug it never actually cleans anything, but it does create an array of all the files in the directory and looks through every element. Every time. So that's 50 * 6500 = 325,000 files it's checking for every page, which is what's causing your problem.

          I fixed both of these things in the pThumb fork.
            Extras :: pThumbResizerimageSlimsetPlaceholders
            • 38290
            • 712 Posts
            Quote from: jgrant at Jul 15, 2013, 03:23 AM
            The problems with phpThumbOf in this scenario are:

            1. It's creating a new set of 50 thumbnails for each page, even if the images are exactly the same from one page to another. That's why your cache has 6500 images in it. As you might imagine this really interferes with browser caching, not to mention generating lots of extra work for the server.
            2. Every time it runs—50 times per page—it attempts to clean its cache. Because of another bug it never actually cleans anything, but it does create an array of all the files in the directory and looks through every element. Every time. So that's 50 * 6500 = 325,000 files it's checking for every page, which is what's causing your problem.

            I fixed both of these things in the pThumb fork.

            I'm confused you fixed phpThumbOf problems in the pThumb fork?
              jpdevries
            • Quote from: dinocorn at Jul 15, 2013, 03:47 AM

              I'm confused you fixed phpThumbOf problems in the pThumb fork?

              Yes, it's available here. It fixes these two bugs plus a number of others.
                Extras :: pThumbResizerimageSlimsetPlaceholders
                • 38290
                • 712 Posts
                Awesome. I know phpthumbof has been collecting dust for a while, but if you'd like I could start the process of merging these enhancements back into the phpthumbof package which is now at modxcms/phpThumbOf on Github.
                https://github.com/modxcms/phpThumbOf
                  jpdevries
                  • 13218
                  • 134 Posts
                  Thanks, both of you.

                  Since you, JP, seem to be excited about pThumb, i will try that first.
                  Thanks, jgrant. I'll report back.
                    @itWilllBeOK
                  • Quote from: dinocorn at Jul 15, 2013, 04:11 AM
                    Awesome. I know phpthumbof has been collecting dust for a while, but if you'd like I could start the process of merging these enhancements back into the phpthumbof package which is now at modxcms/phpThumbOf on Github.
                    https://github.com/modxcms/phpThumbOf

                    Sure, that'd be great. I wasn't aware future development had been moved over to modxcms from splittingred, but it's a good idea.
                    I've got one more performance improvement I'd like to make, and then give it a few days to be more widely tested. Sometime next week things will hopefully be ready for a new version and for the code to be merged into the main phpThumbOf.

                    Quote from: itWillBeOk at Jul 15, 2013, 06:26 AM
                    Thanks, jgrant. I'll report back.

                    Yes, please do. I'm curious to know how much of a difference it makes.
                      Extras :: pThumbResizerimageSlimsetPlaceholders
                    • Generating lots of thumbs on page load is always going to be slow. You might try phpThumbsUp to have your thumbs generate when a file is uploaded, or when someone requests an image. It uses the same syntax as phpThumbOf (or pThumb) with a few more features.
                        www.darkstardesign.com

                        Are you in the Nashville area? Join us for our next MODX meetup!