1
votes

The problem

I use Homestead and I have an images folder under public, and there is a JPG called about_us-employee_1_image.jpg. If I try to open it under its proper URL: http://project.local/images/about_us-employee_1_image.jpg I get a NotFoundHttpException. This happens with only this particular image and only with this specific name. If I change any of its characters it suddenly works again.

Failed solution attempts

The problem is not related to routing because I deleted all of my routes and it still happening. I ran php composer.phar dump-autoload with no success. File and folder permissions are OK (this couldn't be the problem anyway, cause renaming wouldn't solve it).

Is there some kind of rule for naming assets that I'm unaware of?

Stack trace

NotFoundHttpException in compiled.php line 8257:

  1. in compiled.php line 8257
  2. at RouteCollection->match(object(Request)) in compiled.php line 7496
  3. at Router->findRoute(object(Request)) in compiled.php line 7461
  4. at Router->dispatchToRoute(object(Request)) in compiled.php line 7453
  5. at Router->dispatch(object(Request)) in compiled.php line 2302
  6. at Kernel->Illuminate\Foundation\Http{closure}(object(Request))
  7. at call_user_func(object(Closure), object(Request)) in compiled.php line 9585
  8. at Pipeline->Illuminate\Pipeline{closure}(object(Request)) in compiled.php line 2926
  9. at VerifyCsrfToken->handle(object(Request), object(Closure))
  10. at call_user_func_array(array(object(VerifyCsrfToken), 'handle'), array(object(Request), object(Closure))) in compiled.php line 9577
  11. at Pipeline->Illuminate\Pipeline{closure}(object(Request)) in compiled.php line 12949
  12. at ShareErrorsFromSession->handle(object(Request), object(Closure))
  13. at call_user_func_array(array(object(ShareErrorsFromSession), 'handle'), array(object(Request), object(Closure))) in compiled.php line 9577
  14. at Pipeline->Illuminate\Pipeline{closure}(object(Request)) in compiled.php line 11536
  15. at StartSession->handle(object(Request), object(Closure))
  16. at call_user_func_array(array(object(StartSession), 'handle'), array(object(Request), object(Closure))) in compiled.php line 9577
  17. at Pipeline->Illuminate\Pipeline{closure}(object(Request)) in compiled.php line 12686
  18. at AddQueuedCookiesToResponse->handle(object(Request), object(Closure))
  19. at call_user_func_array(array(object(AddQueuedCookiesToResponse), 'handle'), array(object(Request), object(Closure))) in compiled.php line 9577
  20. at Pipeline->Illuminate\Pipeline{closure}(object(Request)) in compiled.php line 12623
  21. at EncryptCookies->handle(object(Request), object(Closure))
  22. at call_user_func_array(array(object(EncryptCookies), 'handle'), array(object(Request), object(Closure))) in compiled.php line 9577
  23. at Pipeline->Illuminate\Pipeline{closure}(object(Request)) in compiled.php line 2983
  24. at CheckForMaintenanceMode->handle(object(Request), object(Closure))
  25. at call_user_func_array(array(object(CheckForMaintenanceMode), 'handle'), array(object(Request), object(Closure))) in compiled.php line 9577
  26. at Pipeline->Illuminate\Pipeline{closure}(object(Request))
  27. at call_user_func(object(Closure), object(Request)) in compiled.php line 9567
  28. at Pipeline->then(object(Closure)) in compiled.php line 2249
  29. at Kernel->sendRequestThroughRouter(object(Request)) in compiled.php line 2232
  30. at Kernel->handle(object(Request)) in index.php line 54
1
did you try php artisan cache:clearErich
I don't know. This question is more than a year old. I moved from Homestead to Laradock.totymedli

1 Answers

0
votes

you can use Storage helper that laravel provide for u but you need to add the new disk in config/filesystem.php

'front' => [
        'driver' => 'local',
        'root' => public_path(),
        'url' => env('APP_URL').'/storage',
        'visibility' => 'public',
    ],

and use it like this

$example=Storage::disk('front')->get('about_us-employee_1_image.jpg')