We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 16277 ☆ A M B ☆
    • 19 Posts
    Hi all,

    From time to time we find ourselves installing MODX in a sub-folder and noticed this was causing issues with Gallery and phpthumbof thumbnail paths.

    The following code replacement seems to address the issue:

    File: /core/model/phpthumb/phpthumb.class.php (line 1024)

    replace:

    $AbsoluteFilename = $this->config_document_root.$filename;


    with:

    $AbsoluteFilename = $_SERVER['DOCUMENT_ROOT'].$filename;


    It does NOT need changing back if you move the install to the root.

    Is there a better way of doing this?
      • 22303 MODX Staff
      • 10,725 Posts
      What is the value of config_document_root when in the subfolder? i.e. what exactly was the problem with how it was before you changed this?
        • 16277 ☆ A M B ☆
        • 19 Posts
        This is taken from the error log:

        ResolveFilenameToAbsolute() prepending $this->config_document_root (/home/sites/mydomain.co.uk/public_html/subfolder/) to $filename (/subfolder/assets/images/pages/home-slides/slide5.jpg) resulting in ($AbsoluteFilename = "") in file "phpthumb.class.php" on line 1025


        Which results in the subfolder appearing TWICE.