We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 31946
    • 116 Posts
    Hi there,

    I don't know if i do something wrong or there's a bug somwhere ;-)
    I create a Mediasource, assign this source to an Image-TV, use the phpthumbof
    output modifier to generate a thumbnail. This works fine when the Default Mediasource "Filesystem" is assigned to the image-tv, but it fails on my custom Mediasource because of that:
    $this->sourceFilename set to "/home/maloulou/www/mydomain.ch//de/upload/images/myimage.jpg" in file "phpthumb.class.php" on line 813


    As you can see, there is a double-slash.. but why?
    I use babel and all the Requests with de/upload ar redirected to upload through .htaccess.

    Context-Settings:
    base_path: /de/
    site_url: http://www.mydomain.ch/

    Mediasource Settings:
    basePath: upload/images/
    baseUrl: upload/images/

    Also what i don't understand: Why am I able to change the Mediasource in the modx-browser when choosing the image via image-tv?
      • 40045
      • 534 Posts
      I have maybe a similar problem, don't know yet what exactly it is^^...

      I also have a image-TV (it is only used in a MIGX Grid TV), this works great so far, but for the ease of use for the editors it would be nice, if the filemanager path (to choose the image) shows only the relevant folders which contain the images, before revo 2.2 I did this in the system settings via the depreciated filemanager_path (or so??), now it seems to be more clever to do it via the filesystem media source...I did edit the existing media source and just changed

      baseBath: assets/site/media/
      baseUrl: assets/site/media/
      


      this works in the filemanager (so it shows only the folders in .../media/) but in the frontend I don't even have a wrong path...the src attribute of the img-tag is just empty...this wasn't the case with the standard empty entries for basePath and baseUrl. With the original settings it works so I'm really not sure where the problem is...is it phpthumbof? MIGX? the imageTV itself?

      have to switch back for now...
        • 28042 ☆ A M B ☆
        • 24,524 Posts
        It appears that image TVs are processed to automatically include the base_url in the TV output, and phpthumbof also prepends the configuration's document_root to the image's path when it determines the full path to the image. This results in the base_url part being doubled.

        ResolveFilenameToAbsolute() prepending $this->config_document_root (/Applications/MAMP/htdocs/hah2/) to $filename (/hah2/assets/images/gear/hat-camo-std.jpg) resulting in ($AbsoluteFilename = "/Applications/MAMP/htdocs/hah2//hah2/assets/images/gear/hat-camo-std.jpg") in file "phpthumb.class.php" on line 1025


        As you can see, phpthumb is prepending the entire document root, in this case including a subdirectory (/hah2/) to the filename of the TV, which also contains the subdirectory.

        Image TVs themselves only store the file's name, such as hat-camo-std.jpg as in this debug output. Somewhere along the line the TV's output is processed to include the absolute URL. This dual addition of the base_url at both stages of processing (MODx itself and phpthumb) results in the duplication of the base_url.

        If line 1024 of core/model/phpthumb/phpthumb.class.php is modified to prepend only the part of the base_path before the subdirectory, then it works. Not the omission of a final /

        //$AbsoluteFilename = $this->config_document_root.$filename;
        $AbsoluteFilename = '/Applications/MAMP/htdocs'.$filename;
        


        However, this is not an acceptable solution to the problem.

          Studying MODX in the desert - http://sottwell.com
          Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
          Join the Slack Community - http://modx.org
          • 14372
          • 49 Posts
          Same issue here. http://tracker.modx.com/issues/7585" target="_blank" rel="nofollow">Bug filed at http://tracker.modx.com/issues/7585


          Issue persists in 2.2.1-pl
            • 28000 ☆ A M B ☆
            • 397 Posts
            Anyone come up with another solution for this? I am having the same issue with a Revo 2.2.5 and Babel 2.2.5...
              Benjamin Davis: American web designer living in Munich, Germany and a MODX Ambassador. I am also co-founder of SEDA.digital, a MODX Agency.
              • 28000 ☆ A M B ☆
              • 397 Posts
              Found the solution here
              https://forums.modx.com/?action=thread&thread=75040
                Benjamin Davis: American web designer living in Munich, Germany and a MODX Ambassador. I am also co-founder of SEDA.digital, a MODX Agency.
                • 8835
                • 21 Posts
                you can always use an output filter like replace to adjust a faulty path.

                babel and phpthumbof won't play ball for me either, but I usually fix phpthumbof-calls like this:
                [[+tv.myimage:replace=`[[++base_url]]==/`:phpthumbof=`w=120&h=120`]]

                This strips the superfluous base_url from the path.

                result:
                old path: /en/assets/content/images/myimage.png
                new path: /assets/content/images/myimage.png

                (asuming you've set your context's base_urls)
                  ▙▚▚▜ I don't think I can, you see, I'd have to want to ▙▚▚▜
                  • 28000 ☆ A M B ☆
                  • 397 Posts
                  What seems to work is to change your image TV output type from default to text. Then the problem went away
                    Benjamin Davis: American web designer living in Munich, Germany and a MODX Ambassador. I am also co-founder of SEDA.digital, a MODX Agency.
                    • 16337
                    • 44 Posts
                    Quote from: sonicpunk at Jun 25, 2013, 04:08 AM
                    What seems to work is to change your image TV output type from default to text. Then the problem went away

                    Brilliant this actually works - as soon as I changed the TV output to "Text" from "Default" it just plain started working.
                      • 36613
                      • 328 Posts
                      Quote from: emkay at Feb 18, 2013, 06:58 AM
                      you can always use an output filter like replace to adjust a faulty path.

                      babel and phpthumbof won't play ball for me either, but I usually fix phpthumbof-calls like this:
                      [[+tv.myimage:replace=`[[++base_url]]==/`:phpthumbof=`w=120&h=120`]]

                      This strips the superfluous base_url from the path.

                      result:
                      old path: /en/assets/content/images/myimage.png
                      new path: /assets/content/images/myimage.png

                      (asuming you've set your context's base_urls)

                      This does not seem like the solution for CMS at this level. Is possibile resolve this problem ?