Assignment Solutions Request using PHP's GD Library

Background Information

Several CS courses post solutions online with the student's Quest ID as a watermark. This page describes a PHP script that provides such a feature. The script uses PHP's GD image library. Students will see the solutions as a PNG image file. Sample output (shrunken):

Sample Output

There is another set of scripts (AssignmentSolutionPHPScript) which also adds watermarks. Those scripts use PHP too, but the image processing is done with a bash script and ImageMagick.

Setting Up the Script

If your course has never used this script before:

Do this at the start of every term:

  1. Open /u/csXXX/public_html/SolnsWatermark/generateWatermark.php
  2. Edit the $staff array to include the term's ISC, tutors, and instructors.

What To Do For Each Assignment

Step 1: Convert the solutions to a PNG image file

  1. If the solutions are in plain text, first convert it to a PDF. This can be done by printing the solutions to a PDF file.

Who can view solutions?

Only these people can view solutions:

  • Students listed in /u/csXXX/.classlist
  • Students listed in /u/csXXX/.exceptions
    You can manually grant access for specific students by putting them in this file. Each line in .exceptions should be this form:
    studentIDno:QuestID
    Please don't add any spaces or tabs at the end. Example line: 20401835:j9smith
  • Staff listed in the $staff array in generateWatermark.php
    Staff can add a u variable at the end of the URL to change the watermark text. For example:
    https://www.student.cs.uwaterloo.ca/~csXXX/SolnsWatermark/generateWatermark.php?assn=a00q1&u=whatever

Log File

A log entry is made every time someone successfully views a solution. The log file is /u/csXXX/course/SolutionsRequestLog.txt. Each entry has the format:

Time, Watermark Text, Quest ID, assignment ID

Edit | Attach | Watch | Print version | History: r4 < r3 < r2 < r1 | Backlinks | Raw View | Raw edit | More topic actions...
Topic revision: r3 - 2011-12-19 - YiLee
 
This site is powered by the TWiki collaboration platform Powered by PerlCopyright © 2008-2025 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback