We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 32645
    • 377 Posts
    I have installed MODX on a beta folder (ie: /beta/) and I have a template variable called tv_media which is an image.

    On the root of the website there is an assets folder, this is not related to MODx, however MODx keeps pointing to this assets folder.

    In the configuration the settings are:


    File Browser URL: /assets/

    When editing a page that uses the tv_media template variable and pick an image it always references /assets/ and not /beta/assets/

    I tried changing the file browser url to the following:


    /beta/assets/
    beta/assets/
    /full/path/to/beta/assets/

    Regardless of what I do MODX does not pick up the right assets folder.

    I’ve tried hacking my code to do /beta/assets/images/someimage.jpg in the template but the image never appears.

    How do I resolve this problem? I really don’t want to re-install MODx as I’ve spent all day setting up the pages.

    Thanks
      • 3749
      • 24,544 Posts
      Try putting this in the <head> section of your templates (if not already there):

      <base href="[(site_url)]" />


      Do you have friendly URLs turned on?
        Did I help you? Buy me a beer
        Get my Book: MODX:The Official Guide
        MODX info for everyone: http://bobsguides.com/modx.html
        My MODX Extras
        Bob's Guides is now hosted at A2 MODX Hosting
        • 32645
        • 377 Posts
        Hi there.

        I investigated the problem, and the problem was not with MODX itself, but with the MiniPhoto Snippet.

        When I reviewed the snippet it tries to find out whether the image exists (I know it does) but it always returned a false.

        In the MiniPhoto snippet I added a few debug output;

        print $mp_img . '<br />';
        print ($modx->config['base_path'].$mp_img);
        print '<br />';
        
        // this never finds the file, even though it exists
        //if (file_exists($modx->config['base_path'].$mp_img)) {
            return '/'.$mp_img;
        //}
        
        



        // Output
        assets/images/mini/image_box.jpg
        /path/to/htdocs/beta/assets/images/mini/image_box.jpg
        /assets/images/mini/image_box.jpg

        The paths to the image should always be /beta/assets/images/image_box.jpg, and thus the paths do not appear to be correct, so I’ve decided to just return the $mp_img as I know the image does exist.

        I may use the PHPThumb snippet instead for thumbnailing if this continues to be an issue.
          • 3749
          • 24,544 Posts
          Quote from: worchyld at Oct 06, 2009, 04:16 AM

          The paths to the image should always be /beta/assets/images/image_box.jpg, and thus the paths do not appear to be correct, so I’ve decided to just return the $mp_img as I know the image does exist.

          I may use the PHPThumb snippet instead for thumbnailing if this continues to be an issue.

          It looks like $imp_img has the /mini dir in its path. Either you need to move the images to the images/mini directory, or you need to change things so that $imp_img doesn’t reference the /mini directory.
            Did I help you? Buy me a beer
            Get my Book: MODX:The Official Guide
            MODX info for everyone: http://bobsguides.com/modx.html
            My MODX Extras
            Bob's Guides is now hosted at A2 MODX Hosting
            • 32645
            • 377 Posts
            I resolved this problem by putting everything in a sub-directory/sub-domain.

            It has resolved all issues.
              • 3749
              • 24,544 Posts
              Glad you got it sorted. smiley

              Would you add [SOLVED] to the subject line of this thread. Thanks.
                Did I help you? Buy me a beer
                Get my Book: MODX:The Official Guide
                MODX info for everyone: http://bobsguides.com/modx.html
                My MODX Extras
                Bob's Guides is now hosted at A2 MODX Hosting