Page 1 of 1
How do you show <img> tags on screen, as code?
Posted: Mon Feb 12, 2018 10:24 am
by simonmlewis
I want to provide the IMG code to someone on a webpage, without it rendering as an image.
ie.
<img src='.....' >/ And it show on screen as code.
How do you do it?
Re: How do you show <img> tags on screen, as code?
Posted: Mon Feb 12, 2018 11:00 am
by Christopher
Code: Select all
$html_with_img = '<img src="....." >';
echo htmlspecialchars($html_with_img);
Re: How do you show <img> tags on screen, as code?
Posted: Thu Feb 15, 2018 10:59 am
by simonmlewis
For some reason, when I narrow the screen to mobile format, the text in the box goes off the screen, as it's not properly wrapping.
Is there a way to force it to wrap?
It's cause a horiz-slider on the browser.
Re: How do you show <img> tags on screen, as code?
Posted: Thu Feb 15, 2018 7:12 pm
by Christopher
Put <br> in the places you want it to wrap?
Re: How do you show <img> tags on screen, as code?
Posted: Fri Feb 16, 2018 1:51 am
by simonmlewis
Sorry?
The resulting code being rendered is random.
Re: How do you show <img> tags on screen, as code?
Posted: Fri Feb 16, 2018 3:37 pm
by Christopher
It is not wrapping because there are long stretches of characters without a space. You can manually wrap it at a specific length, or use Javascript to wrap it based on the width of the window.