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?
How do you show <img> tags on screen, as code?
Moderator: General Moderators
-
- DevNet Master
- Posts: 4435
- Joined: Wed Oct 08, 2008 3:39 pm
- Location: United Kingdom
- Contact:
How do you show <img> tags on screen, as code?
Love PHP. Love CSS. Love learning new tricks too.
All the best from the United Kingdom.
All the best from the United Kingdom.
- Christopher
- Site Administrator
- Posts: 13596
- Joined: Wed Aug 25, 2004 7:54 pm
- Location: New York, NY, US
Re: How do you show <img> tags on screen, as code?
Code: Select all
$html_with_img = '<img src="....." >';
echo htmlspecialchars($html_with_img);
(#10850)
-
- DevNet Master
- Posts: 4435
- Joined: Wed Oct 08, 2008 3:39 pm
- Location: United Kingdom
- Contact:
Re: How do you show <img> tags on screen, as code?
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.
Is there a way to force it to wrap?
It's cause a horiz-slider on the browser.
Love PHP. Love CSS. Love learning new tricks too.
All the best from the United Kingdom.
All the best from the United Kingdom.
- Christopher
- Site Administrator
- Posts: 13596
- Joined: Wed Aug 25, 2004 7:54 pm
- Location: New York, NY, US
Re: How do you show <img> tags on screen, as code?
Put <br> in the places you want it to wrap?
(#10850)
-
- DevNet Master
- Posts: 4435
- Joined: Wed Oct 08, 2008 3:39 pm
- Location: United Kingdom
- Contact:
Re: How do you show <img> tags on screen, as code?
Sorry?
The resulting code being rendered is random.
The resulting code being rendered is random.
Love PHP. Love CSS. Love learning new tricks too.
All the best from the United Kingdom.
All the best from the United Kingdom.
- Christopher
- Site Administrator
- Posts: 13596
- Joined: Wed Aug 25, 2004 7:54 pm
- Location: New York, NY, US
Re: How do you show <img> tags on screen, as code?
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.
(#10850)