We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 21872
    • 95 Posts
    Same issue here! I developed a site on a linux box but the live environment is Win 2003, or something similar.

    phpthumbof generates cached images in the correct location but the url it writes looks like this:

    http://myDomain.com/assets/components/phpthumbof/cache/D:/adirectory/myDomain.com/assets/components/phpthumbof/cache/correct_file.foo.4717ef92f758b8cce718e53a95ef31fd.png


    Nothing else seems to be having this problem. If anyone has a solution, I’d really like to hear it.

    Thank you!
      • 31654
      • 238 Posts
      I found this page with loads of config options that someone may find useful:
      http://phpthumb.sourceforge.net/demo/docs/phpthumb.readme.txt

      If anyone has worked out how to crop an image from the top rather than ’zoom crop’ the centre I would love to know!
        Web Development, Web Hosting & Search Engine Marketing by:

        Vitalized | UK
        w. www.vitalized.co.uk

        Website Design | Search Engine Marketing (SEM) | UK MODx web hosting, secure, fast & 100% MODx compatible

        Vitalized | Australia
        w. www.vitalized-australia.com.au

        Website Design | Search Engine Marketing (SEM) | Australian MODx web hosting, secure, fast & 100% MODx compatible
        • 36416
        • 589 Posts
        Quote from: Vitalized at Feb 24, 2011, 10:53 AM

        If anyone has worked out how to crop an image from the top rather than ’zoom crop’ the centre I would love to know!

        That page suggests adding a parameter &zc=TL
          • 36607 ☆ A M B ☆
          • 44 Posts
          Sorry, but I can’t get phpthumbof to work.

          I have created a TV called "tn-articlepage-image1" with the following options: Input Type: Image, Output Type: Text

          In my template I call the TV as follows and the image displays correctly:

          <img src="[[*tn-articlepage-image1]]" alt="single pic"/>
          


          However, when I add the phpthumbof filter, the image fails to display at all. Here is the amended code with the phpthumbof filter:

          <img src="[[*tn-articlepage-image1:phpthumbof=`w=240&h=120]]" alt="single pic"/>
          


          Any suggestions?
            • 28215
            • 4,149 Posts
            Your line:
            <img src="[[*tn-articlepage-image1:phpthumbof=`w=240&h=120]]" alt="single pic"/>


            is missing an ending backtick: `

            <img src="[[*tn-articlepage-image1:phpthumbof=`w=240&h=120`]]" alt="single pic"/>
            
              shaun mccormick | bigcommerce mgr of software engineering, former modx co-architect | github | splittingred.com
              • 36607 ☆ A M B ☆
              • 44 Posts
              Thanks for such a quick response.

              The backtick "`" is included in the TV call that uses the phpthumbof filter, but it still doesn’t display an image.

              Here’s the code:

              <img src="[[*tn-articlepage-image1:phpthumbof=`w=240&h=120`]]" alt="single pic"/>
              
                • 17667
                • 108 Posts
                I also had the issue that some users have noted with phpthumbof outputting an extended path that is incorrect. After looking into it the issue occurs in the phpthumbof snippet at line 94:
                $cacheUrl = $assetsUrl.'cache/'.str_replace($phpThumb->config_cache_directory,'',$cacheKey);


                This line strips out the server document root path from the image path by comparing two variables that both have the server document root path: $phpThumb->config_cache_directory and $cacheKey. Both of these variables have the document root set from the variable $assetsPath, which gets the document root from a getOption call earlier in the script. Since both $phpThumb->config_cache_directory and $cacheKey get the server path from the same source they should match up. But at line 73 we have this:
                $phpThumb->setCacheDirectory();


                I haven’t looked into everything this does but one thing I discovered is that it resets the $phpThumb->config_cache_directory variable. It appears to use a PHP server global to get the real time server document root path. In most cases this is not a problem. But my installation of MODX is on a MediaTemple server where they recommend using an alias for the server document root path. Since the alias does not match the global for the document root it throws off the string replace function that is used to strip out the document root.

                I have a solution which is not very elegant but is working for now. I made a duplicate of the $phpThumb->config_cache_directory. So line 70 becomes:

                $phpThumb->setParameter('config_cache_directory',$assetsPath.'cache/');
                $phpThumb->setParameter('config_cache_directory2',$assetsPath.'cache/');


                Then line 94 is changed to this:
                $cacheUrl = $assetsUrl.'cache/'.str_replace($phpThumb->config_cache_directory2,'',$cacheKey);


                phpthumbof has become a default add-on for my MODX Revo installations, hopefully an update to phpthumbof can be released that addresses this.
                  • 28215
                  • 4,149 Posts
                  Hi luke,

                  Can you file that here by chance: http://github.com/splittingred/phpThumbOf/issues

                  This way it wont get lost in the forums. Thanks!
                    shaun mccormick | bigcommerce mgr of software engineering, former modx co-architect | github | splittingred.com
                    • 36607 ☆ A M B ☆
                    • 44 Posts
                    Luke

                    Thanks for the helpful info.

                    I changed the phpthumbof snippet (lines 70 and 94) as suggested in your post and everything is now working.

                    cheers

                    Matt
                      • 17667
                      • 108 Posts
                      Good to know about the GitHub issue tracker Shaun. I have posted the server path issue there.