We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 38787
    • 74 Posts
    TLDR;
    Set your Media Source baseUrlRelative to false, but use a relative baseUrl.
    :-/


    I have the feeling that Gallery is not equipped to handle a MODX installation on a cPanel-style URL like this:
    www.domain.com/~cPanelUserName/


    The reason is that is seems to (incorrectly) incorporate the ~cPanelUserName part in the absolute file path, like so (taken from the Error Log):
    setSourceFilename(/home/cPanelUserName/public_html/~cPanelUserName/assets/files/gallery/6/17.jpg) set $this->sourceFilename to "/home/cPanelUserName/public_html/~cPanelUserName/assets/files/gallery/6/17.jpg" in file "phpthumb.class.php" on line 263


    I'm having a very hard time tracking down exactly where it gets the tilde part from. I certainly have my MODX_BASE_URL set to /~cPanelUserName/ as this is what the MODX installer determined for itself.

    Can anyone with greater knowledge of Gallery (I've been trawling thru the source for a while now) point out where it uses the BASE_URL when trying to calculate the file path?

    This question has been answered by atmmarketing. See the first response.

    [ed. note: atmmarketing last edited this post 9 years, 11 months ago.]
      • 38787
      • 74 Posts
      I think I got it:

      Line 114 of snippet.gallery.php
      $itemArray['image_absolute'] = $item->get('base_url').$filesUrl.$item->get('filename');


      That line gets the base URL from the Media Source on line 125 of galitem.class.php.

      My Media Source has a relative value of assets/files/gallery/, and it looks like Gallery is happy to resolve that to /~cPanelUserName/assets/files/gallery/ since I have the property baseUrlRelative set to true.

      Now, I believe I have set that to Relative because I could not get it to work with an Absolute URL, but I'll give it a try now.
      • discuss.answer
        • 38787
        • 74 Posts
        Looks like Media Source was the culprit all along: strangely the solution was to simply set the property baseUrlRelative to false, and leave the value of baseUrl as a relative path (that does not begin with a slash et al).