my production server is ubuntu Ubuntu 16.04.3 LTS and I have laravel 5.5 In the route:
/var/www/forumb
my public folder is in the directory:
/var/www/forumb/public
users upload images and these are saved in:
/var/www/forumb/public/uploads/images
the images folder has 777 permissions in the images folder there are images that use the cover and these are shown normal from the views
the problem is that the images that upload the users are not seen from the views and these are in the same folder images
the cover images I can see directly from the browser like this:
the user images
http://forumb.com/uploads/images/5fa7385e1542a31ab9c34419b4d914fe81a11449.jpeg
but these can not be seen, laravel returns 404 error
the only images that can be seen from the views are the ones that came up together with the framework and that are in the images folder
all the others can not be seen until I uploaded an image from filezilla to the server but can not see either
this only happens on the production server, on my localhost everything works normal
this is mi code in the view
<img class="card-img-top border-bot" src="{{ !is_null(user()->image) ? $profile_image : '/uploads/images/facebook-default-no-profile-pic.jpg' }}" class="img-fluid rounded mx-auto d-block" alt="{!! user()->nombre_empresa !!}">
this my controller
public function index()
{
$perPage = 6;
$page = input('page', 1);
$baseUrl = config('app.url') . '/news-and-events';
$items = News::whereHas('photos')->with('photos')->active()->orderBy('active_from', 'DESC')->select('news.*')->get();
$profile_image = profile_image();
$total = $items->count();
// paginator
$paginator = new LengthAwarePaginator($items->forPage($page, $perPage), $items->count(),
$perPage, $page, ['path' => $baseUrl, 'originalEntries' => $total]);
// if pagination ajax
if (request()->ajax()) {
return response()->json(view('website.news_events.pagination')
->with('paginator', $paginator)
->render());
}
return $this->view('news_events.news_events')->with('paginator', $paginator)->with('profile_image', $profile_image);
}
profile_image() function
function profile_image()
{
$image = user()->image;
$gender = user()->gender;
if ($image && strlen($image) > 5) {
return '/uploads/images/' . $image;
}
else {
return "/images/admin/$gender.png";
}
}
the images are uploaded normally but not shown
public/uploads/images
and not somewhere in the storage folder? - sisve<img src="
usage. - Set Kyar Wa Larasset
helper? - Ajay Makwana