A partial archive of edxchange.opencraft.com as of Wednesday July 13, 2022.

Edx discussion photo harvesting

mgoudz

Problem: Images posted in the discussion board get lost.
Solution: discussion photo harvesting script finds images and displays them in a clickable gallery.

This script was used in this DartmouthX course to search for images and display them on a HTML page -
visual discussion tool

Notes:

  1. see the attached file for scripts

  2. the series of scripts put the events from the logs into a database, search the database, build web pages, and upload them to a web server. I was using the database for other analysis, but for simplicity, I would completely cut it out of the process if I were starting again.

  3. With that in mind, it comes down to searching through the event logs for images which I did like this (php):

     function get_image_urls($string)
    

    {
    $regex = ‘/https?://edxuploads.s3.amazonaws.com[^" ]+(.jpg|.jpeg|.gif|.png)/i’;
    preg_match_all($regex, $string, $matches);
    return ($matches[0]);
    }

  4. With the found image, I generated a static web page and used “Final Tiles Gallery” to build the “infinite” scrolling gallery.

Here are the scripts:
edxdownloadscripts.zip (8.8 KB)

antoviaque

@mgoudz I’ve relaxed the rules on the file types that were authorized for uploads - see if you can upload your script now?

mgoudz

@antoviaque Yes, it worked. I was able to upload the .zip file containing the scripts.