- Joined
- Nov 19, 2020
- Posts
- 2,683
- Reaction
- 4,446
- Points
- 1,546
How to put an image in show page as a logo? using laravel.
<img src="{{ asset('images/logo.png') }}" alt="Logo">
asset()
helper function to generate the URL for the image file. The alt
attribute is used to provide an alternative text for the image, which is useful for accessibility purposes.img
tag and define the styles in your CSS file.it shows a broken imageTo display an image as a logo on the show page in Laravel, follow these steps:
1. First, save the image file in the "public" folder of your Laravel application. For example, if you have an image named "logo.png", save it in the "public/images" folder.
2. In your show blade template file, add the following code to display the image:
Code:<img src="{{ asset('images/logo.png') }}" alt="Logo">
This code uses theasset()
helper function to generate the URL for the image file. Thealt
attribute is used to provide an alternative text for the image, which is useful for accessibility purposes.
3. If you want to style the logo with CSS, you can add a class or ID to theimg
tag and define the styles in your CSS file.
That's it! Your image should now be displayed as a logo on the show page.
If the image is not displaying and showing a broken image, then it might be due to the wrong path to the image. Please make sure that the image file is in the correct folder and the folder path is correct.it shows a broken image
src
attribute of the img
tag is correct.src
attribute of the img
tag.php artisan cache:clear
in the command line.