1
I have an image on a page, inserted as follows:
<img src="img/logo.png">
The image usually appears on pages with an address
/page
. But when the URL is in format
/page/sub-plant
the image appears broken. How can I fix this?
1
I have an image on a page, inserted as follows:
<img src="img/logo.png">
The image usually appears on pages with an address
/page
. But when the URL is in format
/page/sub-plant
the image appears broken. How can I fix this?
3
The right thing would be for you to use an Laravel method for images.
Has two forms:
{{ HTML::image('img/logo.png') }}
Or
<img src="{{ URL::to('img/logo.png') }} />
These ways work on any page, since these methods take into account the folder public as standard for images, scripts and Styles.
No one gave +1. That’s exactly it. Good answer.
Browser other questions tagged php html laravel-4
You are not signed in. Login or sign up in order to post.
better explain what would be this "broken image". Understand that using img/logo.png means that in /page it will fetch the image in /page/img and when the url is /page/subpagina in /page/subpagina/img unless there are rewriting rules that force urls /img to another path. Try to use
<img src="/img/logo.png">
or use some Lavarel Path function to generate the right url for the image.– Marcos Regis
Thank you.
<img src="/img/logo.png">
worked– Amanda Lima