We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 35560
    • 7 Posts
    I have a TV that is an image (input type: image / output type: text). Can I force the file browser to return an absolute URL when the user selects an image? I have looked at various system settings, and none seem to do the trick.

    My goal is to restrict the users of the file browser to /assets/resources. However, if I do this in the TV input options, the value returned is relative to /assets/resources, and the result is a broken image link.

      • 33968
      • 863 Posts
      You could create a system setting called img_path containing [tt]assets/resources/[/tt] and then build your link like this:
      <img src="[[++site_url]][[++img_path]][[*imageTV]]" />
      


      Or to simplify your template markup, create a snippet img_path containing this code:
      <?php
      $img_path = $modx->getOption('img_path');
      $site_url = $modx->getOption('site_url');
      return $site_url.$img_path.$input;
      

      and call it as an output filter:
      <img src="[[*imageTV:img_path]]" />
      

        • 35560
        • 7 Posts
        Works perfectly! Thanks!!