We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 33982 ☆ A M B ☆
    • 476 Posts
    I'm using PHPThumbof on MODx 2.1.3pl. The output is named like this:

    /assets/components/phpthumbof/cache/af453249b79e67d03b8c52c65601f94a.a8a5cd0e1bc95a555928ad1f891c11b8.jpg


    Is there anyway to change the image name to the original image instead of a cached image name? Something like:

    /assets/components/phpthumbof/cache/original-image-name.jpg


    Clients have been asking about this in regards to creating a search engine friendly image name. Awesome snippet by the way!
      Precision Web Development ... SmashStack.com
      • 28215
      • 4,149 Posts
      No, as the phpthumbof output filter determines the cache name with a hash of the properties you pass to it and the filename of the original file.

      If you allowed it to set a specific name, you would run into conflicts with similarly named files.

      That said, I could add a toggleable option for people - understanding that name conflicts could occur - if it's desired enough. You could file that as a Feature Request here: https://github.com/splittingred/phpThumbOf/issues
        shaun mccormick | bigcommerce mgr of software engineering, former modx co-architect | github | splittingred.com
        • 33968
        • 863 Posts
        You might look into this solution which I've implemented on a number of sites without any issues:
        http://mrphp.com.au/code/image-cache-using-phpthumb-and-modrewrite

        It's nice and efficient and you end up with clean, seo-friendly file paths too.
          • 33982 ☆ A M B ☆
          • 476 Posts
          @Lucas: thank you so much for providing the link. I've been using PHPThumb for years on Evo, but the PHPThumbOf snippet for Revo's caching is just amazing. When using PHPThumb in Evo, it seemed the caching was a bit laggy and took a few seconds for photos to load up. Have you compared this snippet in the link to the Revo's PHPThumbOf snippet? Just curious...

          @splittingred: yeh, i figured the name conflict was going to be an issue, but thought I'd ask anyways wink Wasn't sure if there was a way to store images in directories giving them their own unique location...maybe that's a horrible approach, but crossed my mind. I'll file that on the feature request. Overall the snippet is amazing...so much faster than using PHPThumb with Evo...the Revo caching is phenomenal.
            Precision Web Development ... SmashStack.com
            • 33968
            • 863 Posts
            Yes, I've compared both and not really found a difference in performance but I really didn't like the hashed file names.

            I guess if the original image paths were used in the phpThumbOf caching mechanism then that would rule out any naming conflicts - that's how the mrphp script works and I've not had any issues.

            Something like:
            /assets/components/phpthumbof/cache/320x140/image-path/original-image-name.jpg
            

            Where 320x140 represents the thumbnail size. I use a subdomain pointing to the cache folder which brings the path depth down a bit:
            http: //thumbs.sitename.com/320x140/image-path/original-image-name.jpg
            
              • 33982 ☆ A M B ☆
              • 476 Posts
              Interesting...maybe it's the way I had configured PHP thumb in the past, but loading a page with images would drag on...especially if there were a lot. I had a lot of client complaints about it. Now with Revo caching the image (and maybe this was just as doable on Evo), it has made a world of difference. I'd be curious to see how you configured your settings on Evo. I just grabbed PHP off the internet, dropped it on my server and would call the images using PHP thumb in the image path. I had changed the config settings for PHP thumb to cache the images, but it was still really slow.
                Precision Web Development ... SmashStack.com