hanif-king's avatar

laravel does't display Image in online hosted server

image not displaying in webpage interface while it was fine and displayed in localhost

i made an app with laravel 5.2 and it was correct in localhost but while we have uploaded it to online server we faced a vary bad error. all images which are comes from database it is not showing in webpage interface. i am storing images in laravel rout directory storage folder and image links to database table each image gets the exact stored image URL value but not displaying and when i copied the image URL and past it to browser independently it says an error "Whoops, looks like something went wrong." i am accessing images with via these methods

1 src="{!! url('mvimage/'.$image->image) !!}" 2 src="{{ url::to('mvimage/'.$image->image) }}" 3 src="{{ url::secure('mvimage/'.$image->image) }}"

0 likes
3 replies
wottavm's avatar

Turn on debugging so you can see what is happening.

simondavies's avatar
Level 26

when you say your storing the images within the storage folder are you talking outside the public folder? If so thats why you get the error as it cannot look beyond the (behind) the public folder.

Best place them with the public folder so you will have public/mvimage/IMAGENAMEetc then you can do you src like the following:

    <img src="/mvimage/{!!$image->image!!}" alt="" />

But if they are outside the public folder it will error as the pathing is all wrong.

Think you coudl also try the following which gives you access to the storage path area

      <img src="{!! storage_path('mvimage/' . $image->image ) !!}"  alt="" />

Something like that

1 like
hanif-king's avatar

thank you Dear Engineers ! if i make the directory of images in the public folder it need a lots of changes . is there any way to make the specified folder as a public? my image folder is in "storage/app" folder if i say to laravel engine put a privilege of public on the app folder is that possible or not ? i am sure there is something which handles this. thank you so much ..!

Please or to participate in this conversation.