shan
shan

Reputation: 43

How display image in laravel 5.3

I store image in public folder now i want to display the image i give the path but image not show any one help me whats the wrong in my code

My image complete path is public/admin/product

<img src="public/admin/product/<?php echo $productr['image'];  ?>" height="30px" width="30px">

Upvotes: 4

Views: 43254

Answers (6)

Ed McDarwin
Ed McDarwin

Reputation: 11

<img src="{{storage/app/images/.($employee -> image)}}" width="50px">

"storage/app/images/" is the folder path to where your images are stored.

Upvotes: 0

sainath kishore
sainath kishore

Reputation: 11

hope this will help

{{ asset('public/imagepath/image_name') }}

Upvotes: -1

Rohit K. Singh
Rohit K. Singh

Reputation: 36

@if ($productr['image'])
<img src="{{ asset('images/profile/'.$productr['image']) }}" alt="{{ $category->user->image }}">
@else
<img src="{{ asset('assets/dist/img/default-150x150.png') }}" >
@endif

Upvotes: 0

Tayyab Hussain
Tayyab Hussain

Reputation: 1838

Laravel view files blade.php supports {{}} tags to display values.

{{ $valueToBeDisplayed }}

In your case, you can do like

<img src="/admin/product/{{ $product['image'] }}" height="30px" width="30px" />

Assuming image name is abc.png.

Make sure you have that image in folder public/admin/product/abc.png

Upvotes: 2

Parth Vora
Parth Vora

Reputation: 4114

First thing, you should not store those images inside public directory. Instead you should use Storage directory. Please have a look to the Laravel documentation:

https://laravel.com/docs/5.3/structure#the-storage-directory

So, upload such images inside "storage/app/public"

Then fire below artisan command to create symbolic link:

php artisan storage:link

And then create a link to that image:

<img src="{{ echo asset('storage/file.png') }}" height="30px" width="30px">

Upvotes: 3

sigmaxf
sigmaxf

Reputation: 8482

remove public from your path.., also, you might have typos on the variable $productr, (did you mean $product?) try

<img src="admin/product/<?php echo $product['image'];  ?>" height="30px" width="30px">

or, using blade standard:

 <img src="admin/product/{{ $product['image']; }}" height="30px" width="30px">

Upvotes: 2

Related Questions