We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 30585
    • 833 Posts
    Hi guys,

    I'm storing some files on Amazon S3 and I've created a DNS A record that pretty much hides the real path to the S3 bucket.

    The following:
    http://bucketname.s3.amazonaws.com/videos/myvideo.mp4

    Is replaced by:

    http://bucketname.mysite.com/videos/myvideo.mp4
    I'm storing the video source path in a TV (file) that browses S3(media source) for videos and of course I'm forced to manually replace each instance of the ".s3.amazonaws.com" in that TV with the virtual subdomain to hide the path for hundreds of documents.

    I'd like to create a plugin that takes care of that automaticaly by simply hiding the S3 pathing without erasing the absolute value from the TV.

    Here's what I've achieved so far:
    <?php
    
    //Getting the processed value of the TV (current document)
    $value = $modx->resource->getTVValue('VideoPlayer-EDGE-Setup-Message');
    $source = ".s3.amazonaws.com";
    
    $sourceMask = str_replace("$source", "", "$value");
     return $sourceMask;
    
    ?>


    Somthing is obviouslyy missing. How do I invoke the OnBeforeDocFormSave event here and am I right in using return [ed. note: treigh last edited this post 11 years, 7 months ago.]
      A MODx Fanatic
      • 30585
      • 833 Posts
      I guess sometimes we just love hard solutions when easy ones are with us. Why not an output modifier?
      I'll simoy run a REPLACE command in sql to replace old instances, but rely on a default TV value in new docs.

      Sorry for the annoyance
        A MODx Fanatic