gn0stik
03-26-2007, 08:53 PM
1) Script Title:
image thumbnail viewer
2) Script URL (on DD):
http://dynamicdrive.com/dynamicindex4/thumbnail.htm
3) Describe problem:
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, as you can see from the instructions....
<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 converter 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 matching 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? I have several lines I need to format this way, if someone could help me by doing the first one as an example of how to do it with an href, that would be great.
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.
I also posted this in the php forum but got no replies after 3 days so I'm posting it here. Admins can delete the other one.
Any help would be appreciated,
Rich
image thumbnail viewer
2) Script URL (on DD):
http://dynamicdrive.com/dynamicindex4/thumbnail.htm
3) Describe problem:
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, as you can see from the instructions....
<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 converter 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 matching 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? I have several lines I need to format this way, if someone could help me by doing the first one as an example of how to do it with an href, that would be great.
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.
I also posted this in the php forum but got no replies after 3 days so I'm posting it here. Admins can delete the other one.
Any help would be appreciated,
Rich