We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 13729
    • 5 Posts
    Not sure I can call this a bug at the moment... may be a fundamental shift in how Revo handles image paths...

    filemanager_url / filemanager_path - assets/files/

    This is perfect for limiting client from seeing root files, but here’s the rub:

    When I choose an image via file browser, the link that updates is what’s happening now is that when I choose an image file for an image TV, the path that updates is:

    assets/files/path/to/file/file.jpg

    but when I come back to that same resource and check that image TV it shows

    path/to/file/file.jpg

    what’s funny is that in the database it’s correct, but the manager is chopping that filemanager_url/filemanager_path bit in the image TV. That would be fine except that if you make an edit to another part of the resource and save it, it’s now written over the proper image path.

    In Revo 2.0.4 it would maintain the full and proper path, while still locking down root files in the file browser. I double checked (using another client’s site that still uses Revo 2.0.4) and everything works as expected.

    Anyhow, is this a just a shift in how Revo manages file manager paths, or perhaps some other setting I haven’t taken into account? This site was created with a new Revo 2.0.4 install with a 2.0.6 upgrade, and was after the upgrade when it broke/changed.

    if this is a shift, I’ll just update all my chunks to include that additional path, otherwise I’ll hold off.

    Revo 2.0.6-pl2 (trad)
    CENTOS 5.5
    Apache 1.3.42
    PHP Version 5.2.14
    MySQL 5.0.91-community (local)
    pdo_mysql installed
    Firefox 3.6.13, Safari 5.0.3

    Thanks!
    Justin
      • 28215
      • 4,149 Posts
      This seems to be a bug. Can you report it here: http://bugs.modx.com ? Thanks!
        shaun mccormick | bigcommerce mgr of software engineering, former modx co-architect | github | splittingred.com
        • 13729
        • 5 Posts
        just did, thanks!
          • 31724
          • 24 Posts
          I was just about to submit the same problem. I can confirm the same behaviour in my Revo 2.0.6 installation.
          In my case system settings for paths are:
          filemanager_path = assets/webfiles/
          filemanager_path_relative = Yes

          When selecting image for Image TV everything works fine and selected file including path e.g. "assets/webfiles/myimage.jpg" is saved in database and shown in TV field. Problem happens when you edit (refresh) this resource again. Image TV is stripping filemanager path from saved value. and it becomes just "myimage.jpg". Worst thing is you might even not notice this because you are just changing page title and not looking into TV tab!

          Digging into code I found the source of the problem. It is renderer script for Image TV which strips filemanager_path from TV value when rendering TV form field when filemanager_path_relative is set to Yes - file /core/model/modex/processor/element/tv/renders/mgr/input/image.php - there is:

          if ($isRelativeBaseUrl) {
              $basePath = $this->xpdo->fileHandler->getBasePath(false);
              $baseUrl = $this->xpdo->fileHandler->getBaseUrl(true);
              $value = $this->get('value');
              if ($baseUrl != '/') {
                  $value = str_replace($baseUrl,'',$value);
              }
              $value = ltrim($value,'/');
              $this->set('value',$value);
              $this->xpdo->smarty->assign('tv',$this);
          }


          Can someone from coders explain what was the purpose of changing saved image-file value here? We don’t do it for File TV - it works OK, so why for Image TV?

          As a quick fix I commented out this section of code and all works fine now.



            • 13729
            • 5 Posts
            vlado12345, you said it way better than I did! Thanks.
              • 21056
              • 327 Posts
                Author: ManagerManager plugin - customise your ModX manager interface

                Rckt - web development, Sheffield, UK