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:
-
see the attached file for scripts
-
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.
-
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]);
} -
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)