I can fix the issue by setting Security->Site Policies->Force users to log in to view user pictures to "NO". I would rather not do that though. Any ideas?
General developer forum
Get moodle user profile image in PHP
ဆွေးနွေးပွဲ သော့ခတ်ထားသောကြောင့် အကြောင်းပြန်၍ မရတော့ပါ။