Skip to content
Advertisement

Laravel image paths from controller to view

My image’s path is public/uploads/users/image.png then using src like this:

JavaScript

But for every user the image has to be changed.

I pass the image name of the user from controller as something like this

JavaScript

Here, I have to change the user image as per $user_img from controller

How should I give it in the src of image tag.

I tried like this way

JavaScript

But it seems to be an error for me.How should I resole this.

Somebody help me.

Advertisement

Answer

You can use this method for image in laravel.

if this is your image path public/assets/uploads/users/image.png.

image in $user_img

JavaScript

Or we can use

JavaScript
User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement