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.
Download the file WatermarkSolutions.zip at the bottom of this page, and save it somewhere on the course account. In a terminal, cd
to where you saved it, and run:
unzip WatermarkSolutions.zip cd WatermarkSolutions bash Install.sh
Now, open /u/csXXX/public_html/SolnsWatermark/generateWatermark.php
and edit the $staff
array to include the term's ISC, tutors, and instructors.
You can now open a Web browser and try going to these URLs. Use your actual course instead of csXXX.
https://www.student.cs.uwaterloo.ca/~csXXX/SolnsWatermark/generateWatermark.php?assn=demosolns1 https://www.student.cs.uwaterloo.ca/~csXXX/SolnsWatermark/generateWatermark.php?assn=demosolns2 https://www.student.cs.uwaterloo.ca/~csXXX/SolnsWatermark/generateWatermark.php?assn=demosolns3
You should see some sample code with your Quest ID as a watermark.
You can now edit requestAssnSoln.php. That file contains PHP, but it's mostly just HTML. It displays links to the solution files. Edit it so that it fits nicely with your course website's design.
Do this at the start of every term:
/u/csXXX/public_html/SolnsWatermark/generateWatermark.php
$staff
array to include the term's ISC, tutors, and instructors.
Method 1: Use an image editor
Open the PDF file in an image editor like Photoshop or Gimp. Then save the file as a PNG.
Method 2: Use ImageMagick's convert
command
In a terminal, navigate to the directory containing your PDF file. Then use a command like:
convert PDF-to-convert.pdf -flatten -trim Output-picture.png
Notes:
After you have the solutions in a PNG file, move it to /u/csXXX/SolutionsRequest/filename.png
. Choose any filename you like.
Open /u/csXXX/public_html/SolnsWatermark/generateWatermark.php
and add an entry to the $solution_files
array. Use any key you like. For the associated value, put the path to your PNG file.
Add a link in requestAssnSoln.php. The link should point to generateWatermark.php?assn=ASSNID
, where ASSNID
is the key you used in generateWatermark.php
.
Try viewing the solutions to make sure it looks good. If the watermark is not transparent, open your PNG file in an image editor and re-save it.
studentIDno:QuestID
20401835:j9smith
$staff
array in generateWatermark.php 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
/u/csXXX/course/SolutionsRequestLog.txt
. Each entry has the format:
Time, Watermark Text, Quest ID, assignment ID