Preg_replace() regex syntax to add timthumb to img URL?
-
I don’t understand regex syntax. Could someone assist?
I would like to add to image URLs a timthumb.php reference. Below is the code which currently merely removes all <img> references:
<?php ob_start(); the_content('Read the full post',true); $postOutput = preg_replace('/<img[^>]+./','', ob_get_contents()); ob_end_clean(); echo $postOutput; ?>
I would like this line
$postOutput = preg_replace('/<img[^>]+./','', ob_get_contents());
to add the following text to the img URL (in bold):<img src=”https://MYBLOG.com/timthumb.php?src=IMAGEURLHERE&w=476&h=275&zc=1&q=200“/>
Basically, I can’t sort out what the syntax is doing, though anyone with PHP experience would be able to. I only need to add text before and after the img URL. Ideas?
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘Preg_replace() regex syntax to add timthumb to img URL?’ is closed to new replies.