I'm trying to use the Directory API to pull user information, which I'm able to do, but I can't seem to find any good examples on how to access user images.
I tried the following, which gets me a photo resource:
$photo = $service->users_photos->get($uid);
After that I found the utility method for web-safe base64 decoding and tried to access the data like so:
$data = Google_Utils::urlSafeB64Decode($data);
$data = base64_encode($data);
return "data:" . $mime . ";base64," . $data;
However, this produces a pixelated image. So I'm either missing a step or something is wrong with the data I'm getting. I can't seem to find any documentation on how to get this image using PHP, is there an official method for decoding the bytes received in photoData and converting them to an image?