PDA

View Full Version : Converting image tags [img=url] to [img]url[/img]



trhoppe
Mon 18th Aug '08, 1:42pm
From reading, sounds like cleaner.php is my best solution, but what exactly is the regular expression that I need to run inside of cleaner to conver

Thanks!

Jerry
Mon 18th Aug '08, 3:30pm
This should help, the img regex there should do what you're after :

http://www.vbulletin.com/forum/showthread.php?t=282129

trhoppe
Tue 19th Aug '08, 12:31am
This should help, the img regex there should do what you're after :

http://www.vbulletin.com/forum/showthread.php?t=282129

That doesn't quite get what I needed.

The url of the image is INSIDE the tags.

-Tom

dave683
Tue 19th Aug '08, 12:41am
That doesn't quite get what I needed.

The url of the image is INSIDE the tags.

-Tom

Try that. Back up ur data first XD


$text = preg_replace('#\' ,$text);

Jerry
Tue 19th Aug '08, 12:42am
Which would be :



$text = preg_replace('#\#siU', '', $text);

Jerry
Tue 19th Aug '08, 12:43am
Try that. Back up ur data first XD


$text = preg_replace('#\' ,$text);

Close, though that won't clean out what is in between the tags and match-to-replace the origional closing one.

trhoppe
Tue 19th Aug '08, 12:58am
Close, though that won't clean out what is in between the tags and match-to-replace the origional closing one.

Actually $text = preg_replace('#\', $text); was it :)

I now understand a bit more about reg exps but I still have no idea what "$1" is in the replacement and how that works.

The other one which had preg_replace('#\#siU' never matched as the dumb megaBBS board never had closing img tags.

Jerry, thanks for all the help with the import, this thread and the others that you answered had great advice and help!

dave683, thanks for the help with that statement :)

-Tom

Jerry
Tue 19th Aug '08, 3:56pm
Ah yes, my bad, I didn't read it fully and missed that there was no closing [/img] tag ..... !

dave683
Wed 20th Aug '08, 2:13am
:p
.
.
.