Hi,
I need to change all image tags that reference an uploaded image file name to a new reference. e.g.
The html page has following image tags;
<img src="../news/190/myimg.html" class="blkthin">
i need to change these the uploaded image file name i.e.
<img src="myimg.jpg" class="blkthin">
As I need to match the multiple uploaded image filenames to their relevant image tag references, I'm using the following code to make the changes:
$contents = preg_replace("/<img src=\"((http(s?):\/\/)|(www\.)|([\w\.]+)|([\/\w]+))($userfile_name)/i", "<img src=\"$userfile_name\" alt=\"$1",$contents);
The problem is that although this will work without the "($userfile_name)" reference, I need to be able to reference the relevant image file name to make the changes.
What changes do I need to make to the preg_replace code in order to do this?
Cheers
Synfield😕