Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Laravel doesn't show image

I have this in my view.blade.php:

{{HTML::image('resources/views/Folder/Subfolder/Subfolder/Photo/'.$item->Photo)}}

$item->Photo takes the image name from the database.

In the same view I have use HTML;, and what I see on the screen is this:

<img src="http://localhost:8000/resources/Folder/Subfolder/Subfolder/Photo/3da0d12d6d8667963392a446262b1773.jpg">

If I replace {{HTML::image.... with the following:

<img src="resources/Folder/Subfolder/Subfolder/Photo/{$item->Photo}}" alt="NO PHOTO">

I see this on the screen:

<img src="http://localhost:8000/resources/Folder/Subfolder/Subfolder/Photo/3da0d12d6d8667963392a446262b1773.jpg">

NO PHOTO

The picture exists, I saw it in the folder. I'm doing something wrong, I just don't know what.

I'm thinking that Laravel wants pictures to be in a specific folder... could this be the cause of the problem? Do you have any ideas?

In my controller I have this:

$destinationPath = base_path().'\resources\Folder\Subfolder\Subfolder\Photo';
            chmod($destinationPath,0777);

The picture size is 7.673 bytes. I tried it with another image, and it doesn't work either. It seems that something is preventing all browsers from showing the pictures on localhost.

Has anyone encountered this problem before ? I don't know what else I should try ...

like image 917
Texas Avatar asked Jul 23 '15 09:07

Texas


1 Answers

{{ asset("storage/uploads/$notes->file_name")}}

this worked for me. i had file in uploads of storage/app/public folder. tried so many things. turns out its little confusing but awesomely simple once u figure it out. i am in laravel 5.4

like image 179
Saugat Thapa Avatar answered Sep 19 '22 18:09

Saugat Thapa