gn0stik
03-25-2007, 10:09 PM
I'm trying to integrate the thumbnail script into my forums for image uploads.
I've integrated everything but the last bit where you set the images up as hrefs instead of img tags.
The script requires you to format the images like this.
<p><a href="http://img201.imageshack.us/img201/6923/countryxb6.gif" rel="thumbnail"><img src="thumbnail.gif" style="width: 50px; height: 50px" /></a></p>
Now in my forum's tag to html convertor area there's a section that uses preg_replace to translate the bbcode into html for display in the forum.
I'm not familiar with the pattern formatting in php, and preg_replace requires you to use escape chars etc to format it in such a way that the string is replaced correctly.
Currently the line I'm trying to change looks like this.
Code:
$sb_message_txt = preg_replace("/\[img\](.*?)\[\/img\]/si","<img src=\"$1\" border=\"0\" />",$sb_message_txt);
Every time I try to format the href with this pattern recognition syntax, I break my forum. I've read a rather large reference on preg_replace, and pattern matching in php, but have thus far been unsuccessful.
Can someone show me how it should look?
This is what I've done so far, that has not worked.
$sb_message_txt = preg_replace("/\[img\](.*?)\[\/img\]/si",<p><a href=\"$1\" rel=\"thumbnail\"><img src=\"thumbnail.gif\" style=\"width: 50px; height: 50px\" /></a></p>,$sb_message_txt);
I got a parse error with that one.
Any help would be appreciated,
Rich
I've integrated everything but the last bit where you set the images up as hrefs instead of img tags.
The script requires you to format the images like this.
<p><a href="http://img201.imageshack.us/img201/6923/countryxb6.gif" rel="thumbnail"><img src="thumbnail.gif" style="width: 50px; height: 50px" /></a></p>
Now in my forum's tag to html convertor area there's a section that uses preg_replace to translate the bbcode into html for display in the forum.
I'm not familiar with the pattern formatting in php, and preg_replace requires you to use escape chars etc to format it in such a way that the string is replaced correctly.
Currently the line I'm trying to change looks like this.
Code:
$sb_message_txt = preg_replace("/\[img\](.*?)\[\/img\]/si","<img src=\"$1\" border=\"0\" />",$sb_message_txt);
Every time I try to format the href with this pattern recognition syntax, I break my forum. I've read a rather large reference on preg_replace, and pattern matching in php, but have thus far been unsuccessful.
Can someone show me how it should look?
This is what I've done so far, that has not worked.
$sb_message_txt = preg_replace("/\[img\](.*?)\[\/img\]/si",<p><a href=\"$1\" rel=\"thumbnail\"><img src=\"thumbnail.gif\" style=\"width: 50px; height: 50px\" /></a></p>,$sb_message_txt);
I got a parse error with that one.
Any help would be appreciated,
Rich