I'm creating a text only theme and would like to remove all images tags from the html output. I'm also thinking that I may want to use the alt text to present to the user instead.

I know this is done with preg_replace within template.php, but could do with some help.

Cheers
Mark

Comments

advosuzi’s picture

in your node.tpl.php (or whichever tpl file applies) you can change:

<?php print $content ?>

to

<?php print preg_replace("/<img[^>]+\>/i", "(image) ", $content) ?>

this replaces the image with (image)

markhope’s picture

Thanks a lot for your help.
I'll give it a go.

Do you have an example of how to use the alt text from images?

something that would produce:

image description: alt text here

I'm not sure what best practice is for accessibility?

Cheers
Mark