Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

Spiral's avatar

How to send image from server to client with REST API

how to send path from api in end point

when user logged in send profile image path

when udpate profile in response send new profile image path

0 likes
3 replies
Snapey's avatar

Its just a string. Send it in your reply. Don't send the image itself.

1 like
Snapey's avatar

how can I show you. I dont know how you know where the image is for this user?

1 like
Snapey's avatar

So, in $user_profile->profile_picture you save the path to the user's picture as

profile-pictures/timestamp.originalname.originalextension

and the image is in the public_path (/public/profile-pictures etc etc)

so in your controller you need to return the URL to this

$url = asset($user->profile_picture);
1 like

Please or to participate in this conversation.