views:

45

answers:

2

Here is what I have

<img src="http://some.site.com/v/b/image-name/_thumb_100x100.jpg"&gt;

I'm trying to modify the src by replacing the size to _thumb_200x200.jpg

i tried preg_replace() but nothing .

+1  A: 

Assuming you have that code in a string, you can use str_replace:

$str = str_replace('_thumb_100x100.jpg', '_thumb_200x200.jpg', $str);
NullUserException
+1  A: 

Here's how to do it with preg_replace

$src="http://some.site.com/v/b/image-name/_thumb_100x100.jpg";

echo preg_replace('/_thumb_100x100.jpg/','_thumb_200x200.jpg',$src);
Kranu