RE: [PHP] how to strip just the <img> tag from html file?
| From: | Adrian Ciutureanu | Date: | Mon, 16 Jul 2001 13:19:40 +0000 |
| Subject: | RE: [PHP] how to strip just the <img> tag from html file? | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-58044@lists.php.net to get a copy of this message | ||
$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: sgibbs@vt.globalhealth.org [mailto:sgibbs@vt.globalhealth.org]
> Sent: 16 iulie 2001 14:53
> To: php-general@lists.php.net
> 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: php-general-unsubscribe@lists.php.net
> For additional commands, e-mail: php-general-help@lists.php.net
> To contact the list administrators, e-mail:
> php-list-admin@lists.php.net
>
>