Jump to content

BBcodes with img tag


MemphiS

Recommended Posts

Ive created a function which checks if the image is valid...

 

i use bbcodes like below..

 

function bbcode($code){
str_replace("[img]http://","<img src='",$code);
str_replace("[/img]","' border='0'>",$code);
return $code;

}

 

but i havent worked out how i can use my image function validator to check the specific url between urltoimage

 

Anyone know how i can get this working or an alternative to verifying it? :D

Link to comment
https://forums.phpfreaks.com/topic/58831-bbcodes-with-img-tag/
Share on other sites

You're going to need to use regular expressions for this. Although, as you have done, you can replace parts of the text with str_replace, if you use the ereg() or preg_match() functions, you can also return text between the two things.

 

There are a couple of tutorials on this site for this sort of thing too. You might find them useful:

http://www.phpfreaks.com/tutorials/141/0.php

http://www.phpfreaks.com/tutorials/123/0.php

Link to comment
https://forums.phpfreaks.com/topic/58831-bbcodes-with-img-tag/#findComment-292396
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.