I am scripting a parsing program for article formatting on my site, but I need to do some stuff that I can't figure out easily.
I want to take a variable image name (the actual name is up to the author of the article), such as 001.jpg, and using the format
have php look for text matching that format. When it finds it, I want it to use the file name (001.jpg in this case) as the value for a variable "$image", and the image's name with 't' (such as 001t.jpg) appended as "$thumbnail".
The final output should be something like:
I was going to make a $search and $replace variable set and use preg_replace() to search for the % symbols and parse accordingly, but I dont use regular expressions enough to know how to use it properly.
Any help would be majorly appreciated - thanks in advance.
I want to take a variable image name (the actual name is up to the author of the article), such as 001.jpg, and using the format
Code:
%001.jpg%
The final output should be something like:
Code:
<a href=001.jpg><img src=001t.jpg></a>
I was going to make a $search and $replace variable set and use preg_replace() to search for the % symbols and parse accordingly, but I dont use regular expressions enough to know how to use it properly.
Any help would be majorly appreciated - thanks in advance.