For a year or so I have a big problem I have to solve, I HAVE to solve, but still don't know how. Problem at first was in a approach to the problem, and now it is in regex part.
Since I am not good at regex at all, and I actually need it only for this one problem, please help me to solve this.
In CMS I have WYSWYG editor that gives me source of text like this
problem is that I have to change src part to add phpthumb.php in front (full url to phpthumb, not only file name) and in the end of src I have to put "width=400" or similar, 99% width AND must remove style and alt tag ...
So solution I have come up is that I have to find somehow all src URLs and then to remove all IMG tags and find replace them with new img tags I create as I want to.
Anyone have better idea? Or idea on how to do this I imagined? problem in the end is in whywyg editor that gives me something I cannot change easily. I thing regex would be great to do this and most elegant way on doing it.
Problem could be in that I am not sure if img tag look like this
<img alt="" src="http://www.site.com/v3/pics/Tuning_2.jpg" style="width: 400px; height: 300px;" />
or
<img src="http://www.site.com/v3/pics/Tuning_2.jpg" alt="" style="width: 400px; height: 300px;" />
or
<img alt="" style="width: 400px; height: 300px;" src="http://www.site.com/v3/pics/Tuning_2.jpg"/>
or somehow else ...
-------
to short this up ...
how to find all URLs and find replace all img tags with new tags I create as I want to ...
(similar topic was here http://www.phpfreaks.com/forums/index.php?topic=229756.0 but since I do not know regex, I don't know how to change this)