We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 28042 ☆ A M B ☆
    • 24,524 Posts
    VideoLightbox is a desktop application (for Mac and Windows) that generates a video gallery from a list of YouTube, Vimeo and other video streaming services.

    All you need to do is feed it the URL of the service and the ID of the video to add to the gallery; it gives examples for each of the services that it supports on the input form.

    You can select a number of templates for formatting the thumbnails, as well as the lightbox overlay for the player.

    It then uploads the HTML page it has generated and the necessary support files to a specified remote location with its built-in FTP client. The list of videos is saved on your hard drive for later addition or deletion of videos to the gallery.

    I’ve created a snippet that will read in the HTML page, parse it and chop out the gallery code, load up all of the necessary .css and .js files, and also correct the generated paths to the thumbnails for the gallery. The snippet uses the resource alias as the filename, presuming you told the VideoLightbox application to use that as its filename (alias.html). It also presumes the file was loaded into the assets/media folder. It returns only the section of HTML for displaying the gallery and playing the videos. I found it necessary to configure the QuickManager+ plugin to be disabled for the page the gallery is on; it uses JQuery Tools with its own embedded JQuery library.

    <?php
    // load up the css and js files
    $modx->regClientCSS('assets/media/engine/css/videolightbox.css');
    $modx->regClientCSS('<style type="text/css">#videogallery a#videolb{display:none}</style>');
    $modx->regClientCSS('assets/media/engine/css/overlay-minimal.css');
    $modx->regClientStartupScript('assets/media/engine/js/jquery.tools.min.js');
    $modx->regClientStartupScript('assets/media/engine/js/swfobject.js');
    $modx->regClientStartupScript('assets/media/engine/js/videolightbox.js');
    // read and parse the generated file
    $path = 'assets/media/'; // where the files were uploaded
    $filename = $modx->documentObject['alias']; // use the page's alias for the filename
    $file = file_get_contents($path . $filename . ".html");
    $gallery = explode('BODY', $file);
    $div = $gallery[1]; // break out the relevant gallery HTML code
    $div = ltrim($div, 'section -->'); // clean up the residual from the explode() 
    $div = rtrim($div, '<!-- End VideoLightBox.com');
    $div = str_replace('src="data', 'src="'. $path . 'data', $div); // correct the image path
    return $div;
    ?>

    I have contacted the authors of the application to ask about modifying the HTML generated, but until and unless this can be looked into this snippet does the job.
      Studying MODX in the desert - http://sottwell.com
      Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
      Join the Slack Community - http://modx.org
      • 19369
      • 1,098 Posts
      Thanks Susan, this is so cool.

      The only drawback is that is free for non-commercial use only :’(. They give a business license for free if you translate the website in your native language, but somebody has already translated it in Italian sad:(
        • 28042 ☆ A M B ☆
        • 24,524 Posts
        Even the business license at $50 isn’t all that bad. If your business can’t recover $50 in a week or so, maybe you’re in the wrong business wink
          Studying MODX in the desert - http://sottwell.com
          Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
          Join the Slack Community - http://modx.org
          • 19369
          • 1,098 Posts
          Lol, you’re right tongue
            • 7536
            • 3 Posts
            Hi there... first i’d like to say thnx for this snippet...
            i did everything like you said, made snippet, copied files where it should be, disabled quick manager... and everything worked fine...
            But now I’m experiencing some weird issue. When I’m loged in manager everything works fine... but as soon as i log out in manager i get same issue as if quick manager is still enabled...
            now thing is quick manager have nothing to do with users that aren’t loged in manager, and i can’t figure what else could cause problems...

            any1 else having same problem as i do? Or even better, any1 else have solution for this problem?