laravellaravel-7

Get image from resources folder - Laravel


Can I get and display an image in view from a resources folder instead of public folder? If yes, how can I do that?


Solution

  • resources folder should not be used to store images That's not where public, static assets (like images, js, css etc) should be.

    Put them inside public/ folder

    The resources/assets/ directory is for storing pre-processed assets, so to speak.

    For example, if you have 3 different CSS files but want to merge them into one and render that new single file in the browser (to increase page load speed). In this scenario, the 3 CSS files will be put somewhere inside resources/assets/.

    These files can then be processed, and the new merged file will go inside public.

    Reference:

    https://laracasts.com/discuss/channels/laravel/image-assets?page=1