In some cases, being able to update the moodle user's photo using command line instead of the web interface is pretty helpful. Here is the PHP snippet I wrote which will accomplish that:
1. The photo was name after the user's idnumber. You can use the username instead.
2. Need to run the script as root or sudo.