[themes] Alt text with preg_replace for accessibility

Mark Hope mark at markhope.net
Tue Nov 7 13:59:23 UTC 2006


Hi,

I'm creating a text only version of a site and would like to replace 
inline images with their alt text.

In my template files I have:
<?php print preg_replace("/<img[^>]+\>/i", "(image) ", $content) ?>

which replaces all images with:
(image)

what code would I need to create output like:
(Image description: THE ALT TEXT HERE)

and is this best practice?

Regards
Mark



More information about the themes mailing list