We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 3866 ☆ A M B ☆
    • 350 Posts
    I have a site which has been using the migxResourceMediaPath as a location for images however, this seems to have become unusable in recent MODX upgrade to 2.6.1. Files are no longer located under the Media Source.

    The call for basePath and baseURL have been unchanged are as follows:

    [[migxResourceMediaPath? &pathTpl=`assets/foldername/resourceimages/{id}/`]]

    Whilst this did list images under the media source there the following error would appear in the logs;

    /paas/site/www/core/cache/includes/elements/modsnippet/13.include.cache.php : 69) [migxResourceMediaPath]: docid could not be determined.

    However there is a new error appearing:

    /paas/site/www/core/model/modx/sources/modfilemediasource.class.php : 53) PHP warning: is_dir(): open_basedir restriction in effect. File(/) is not within the allowed path(s): (/paas/site)

    Plus the images are now no longer listed under the Media Source although the folder still exists.

    The site is hosted on MODX Cloud and was using PHP 7.1 but have reverted to PHP 5.6 but this hasn't resolved that issue... had another issue relating to AJAX Upload which seemed to be linked to a compatability isssue with PHP 7.1 which was almost resolved with rolling back to 5.6. Can use AJAX multi upload but not individual upload as I think there is an issue with the media source...

    Any suggestions / solutions to this problem. I have also posted it to github... https://github.com/Bruno17/MIGX/issues/304
      Helen Warner
      Number one pixel!
      Proud to be linked with MODX at Crimson Pixel
      • 51216
      • 35 Posts
      Would also like to know
        • 37914
        • 89 Posts
        I'm also having this problem.
        [2018-06-25 07:58:50] (ERROR @ /cache/includes/elements/modsnippet/8.include.cache.php : 69) [migxResourceMediaPath]: docid could not be determined.
          • 38783
          • 571 Posts
          Does it help if you change the &pathTpl by removing the forward slash after assets?

          In Helens example this would be:

          [[migxResourceMediaPath? &pathTpl=`assets/foldername/resourceimages/{id}`]]

          Looking at the difference in the code between MODX 2.5.2 and 2.6.1 in the file core/model/modx/sources/modfilemediasource.class.php it looks as if the newer code may add a forward slash to the path. My PHP is not good enough to be sure of this - I am just speculating!

          MODX 2.6.1
              public function getBases($path = '') {
                  $properties = $this->getProperties();
                  $bases = array();
                  $path = $this->fileHandler->sanitizePath($path);
                  $bases['path'] = $properties['basePath']['value'];
                  $bases['pathIsRelative'] = false;
                  if (!empty($properties['basePathRelative']['value'])) {
                      $bases['pathAbsolute'] = realpath("{$this->ctx->getOption('base_path',MODX_BASE_PATH)}{$bases['path']}"). '/';
                      $bases['pathIsRelative'] = true;
                  } else {
                      $bases['pathAbsolute'] = $bases['path'];
                  }
          


          MODX 2.5.2
              public function getBases($path = '') {
                  $properties = $this->getProperties();
                  $bases = array();
                  $path = $this->fileHandler->sanitizePath($path);
                  $bases['path'] = $properties['basePath']['value'];
                  $bases['pathIsRelative'] = false;
                  if (!empty($properties['basePathRelative']['value'])) {
                      $bases['pathAbsolute'] = $this->ctx->getOption('base_path',MODX_BASE_PATH).$bases['path'];
                      $bases['pathIsRelative'] = true;
                  } else {
                      $bases['pathAbsolute'] = $bases['path'];
                  }
          
            If I help you out on these forums I would be very grateful if you would consider rating me on Trustpilot: https://uk.trustpilot.com/review/andytough.com

            email: [email protected] | website: https://andytough.com
            • 13218
            • 134 Posts
            I'm having similar problems.
            In my case I found that Firefox strips the HTTP_REFERER of any additional path information besides the protocol and domain
            https://example.com
            .
            But since migxResourceMediaPath snippet seems to depend on parsing the referer for the current resource ID when called via an AJAX request, it now can't find the neccessary ID to build the dynamic path.

            One resource I found on that is https://blog.mozilla.org/security/2018/01/31/preventing-data-leaks-by-stripping-path-information-in-http-referrers/. This only talks about browsing in private mode though. But using FF 62.0.2 I can observe this behaviour in non-private mode.
              @itWilllBeOK