Justtechjobs.com Find a programming school near you






Online Campus Both


php-general | 2001072

RE: [PHP] how to strip just the <img> tag from html file? From: Adrian Ciutureanu (adrian.ciutureanu <email protected>)
Date: 07/16/01

$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 <email protected> [mailto:sgibbs <email protected>]
> Sent: 16 iulie 2001 14:53
> To: php-general <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: php-general-unsubscribe <email protected>
> For additional commands, e-mail: php-general-help <email protected>
> To contact the list administrators, e-mail:
> php-list-admin <email protected>
>
>

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: php-general-unsubscribe <email protected>
For additional commands, e-mail: php-general-help <email protected>
To contact the list administrators, e-mail: php-list-admin <email protected>