Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

regular expression

Status
Not open for further replies.

Hameedullah

Programmer
Aug 12, 2002
29
AU
I am using PNphpBB forum. WE allow users to have a signature and do permit them to use some HTML tags in their posts and also in their signatures.

Some users use large images in their signatures and this is getting really annoying. I have been trying to find a solution but couldn't come up with any. Some use html and some other 'BBCode' to put pictures in their signature.

I do not want to get that feature away from them and want to let them do that, however I want to use regex to find and replace the IMG html tag and and add width and height to it.

For example I want to replace <img src=blahblah> to <img src=blahblah widht = 150 height = 100>. Later on I will resize them proportionally but right now, I am just trying to write a good regex to find and replace.

Thanks
 
Fixed now.... I used str_replace instead of preg_replace.
 
and the RegEx is:
/<img (.*)>/U,"<img height=10 width=10 $1>"



Known is handfull, Unknown is worldfull
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top