PHP Developers Network

A community of PHP developers offering assistance, advice, discussion, and friendship.
 
Loading
It is currently Sun Dec 16, 2018 6:32 pm

All times are UTC - 5 hours




Post new topic Reply to topic  [ 6 posts ] 
Author Message
PostPosted: Mon Feb 12, 2018 11:24 am 
Offline
DevNet Master

Joined: Wed Oct 08, 2008 3:39 pm
Posts: 4426
Location: United Kingdom
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?

_________________
Love PHP. Love CSS. Love learning new tricks too.
All the best from the United Kingdom.


Top
 Profile  
 
PostPosted: Mon Feb 12, 2018 12:00 pm 
Offline
Site Administrator
User avatar

Joined: Wed Aug 25, 2004 7:54 pm
Posts: 13585
Location: New York, NY, US
Syntax: [ Download ] [ Hide ]
$html_with_img = '<img src="....." >';
echo htmlspecialchars($html_with_img);

_________________
(#10850)


Top
 Profile  
 
PostPosted: Thu Feb 15, 2018 11:59 am 
Offline
DevNet Master

Joined: Wed Oct 08, 2008 3:39 pm
Posts: 4426
Location: United Kingdom
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.

_________________
Love PHP. Love CSS. Love learning new tricks too.
All the best from the United Kingdom.


Top
 Profile  
 
PostPosted: Thu Feb 15, 2018 8:12 pm 
Offline
Site Administrator
User avatar

Joined: Wed Aug 25, 2004 7:54 pm
Posts: 13585
Location: New York, NY, US
Put <br> in the places you want it to wrap?

_________________
(#10850)


Top
 Profile  
 
PostPosted: Fri Feb 16, 2018 2:51 am 
Offline
DevNet Master

Joined: Wed Oct 08, 2008 3:39 pm
Posts: 4426
Location: United Kingdom
Sorry?
The resulting code being rendered is random.

_________________
Love PHP. Love CSS. Love learning new tricks too.
All the best from the United Kingdom.


Top
 Profile  
 
PostPosted: Fri Feb 16, 2018 4:37 pm 
Offline
Site Administrator
User avatar

Joined: Wed Aug 25, 2004 7:54 pm
Posts: 13585
Location: New York, NY, US
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)


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 6 posts ] 

All times are UTC - 5 hours


Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
Powered by phpBB® Forum Software © phpBB Group