Skip to content

User Profile Photo

PrasadChinwal edited this page Dec 10, 2024 · 1 revision
use PrasadChinwal\MicrosoftGraph\Facades\MicrosoftGraph;
$image = MicrosoftGraph::users()->withEmail('abc@xxx.xxx.xxx')->getPhoto('48', '48');
dd($image);

Returns Base 64 string. Can be used in image tag as:

<img src="data:image/png;base64, {{ base64_encode($image) }}" alt="Profile Photo"/>
$image = file_get_contents('path_to_your_image/your_photo.jpeg');
$image = MicrosoftGraph::users()->withEmail('abx@xxx.xxxx.xxx')->updatePhoto($image);
dd($image);

On Success returns base 64 of image

<img src="data:image/png;base64, {{ base64_encode($image) }}" alt="Profile Photo"/>
Clone this wiki locally