[PHP] how to strip just the img tag from html file?

2001-07-16 Thread sgibbs

I've created a printer-friendly version of a page (PHP/MySQL) and want to
have just the img tags automatically removed.  I thought about using
strip_tags() but I'm not able to predict what html tags to include as the
exceptions so that they would not be removed too.  How can I do this?  Thank
you!

- Shawna



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP] how to strip just the img tag from html file?

2001-07-16 Thread Adrian Ciutureanu

$printerFriendlyContent = eregi_replace('img[^]*', '', $htmlContent);

You can also use
$printerFriendlyContent = eregi_replace('src=[^]*',
'src=images/spacer.gif', $htmlContent);
to preserve formatting (spacer.gif = 1x1 px transparent)

 -Original Message-
 From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
 Sent: 16 iulie 2001 14:53
 To: [EMAIL PROTECTED]
 Subject: [PHP] how to strip just the img tag from html file?
 
 
 I've created a printer-friendly version of a page 
 (PHP/MySQL) and want to
 have just the img tags automatically removed.  I thought about using
 strip_tags() but I'm not able to predict what html tags to 
 include as the
 exceptions so that they would not be removed too.  How can I 
 do this?  Thank
 you!
 
 - Shawna
 
 
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: 
 [EMAIL PROTECTED]
 
 

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]