Help with editing IMG bbcode

This forum is now closed as part of retiring phpBB2.
Forum rules
READ: phpBB.com Board-Wide Rules and Regulations

This forum is now closed due to phpBB2.0 being retired.
Post Reply
jorgebonafe
Registered User
Posts: 11
Joined: Mon Nov 12, 2007 11:51 pm

Help with editing IMG bbcode

Post by jorgebonafe »

Hello

So, I wonder if anyone can help me with something I'm trying to do on my forum. Please let me know if I'm posting this on the wrong thread.

I made a function that takes an image URL as parameter and returns an image tag, resized depending on a few things there are irrelevant. The function works fine, I use it to resize avatars on the forum. The problems came when I tried using it on [img] tags. I tried modifying the bbcode.tpl. Instead of this line:

Code: Select all

<!-- BEGIN img --><a href="" onMouseOver="SMR_setLink(this);" target="_blank"><img src="{URL}" border="0" alt=""/></a><!-- END img -->
I wrote this line:

Code: Select all

<!-- BEGIN img --><a href="" onMouseOver="SMR_setLink(this);" target="_blank">{URL}</a><!-- END img -->
I removed the whole image tag because I intended to send that to the browser with the function, like I did the avatars.

The problem is that no matter how much I tried, I coulnd't find a way to edit bbcode.php and use that function to send the tag to the browser. I don't understand how the image URL is found on that page, neither how all those functions on bbcode.php work. What I wanted to do was take the URL on the tag, use it to get the correct tag and send the whole tag to the browser, instead of sending only the URL and leaving the basic tag on bbcode.tpl.

Can anyone help me on that?
User avatar
A_Jelly_Doughnut
Former Team Member
Posts: 34459
Joined: Sat Jan 18, 2003 1:26 am
Location: Where the Rivers Run
Contact:

Re: Help with editing IMG bbcode

Post by A_Jelly_Doughnut »

Without knowing what the SMR_setLink JavaScript looks like, it is somewhat difficult to say what you'd need to do. My first guess would be to add a preg_match_all call to the bbcode_second_pass function that will grab Image URLs and do the kind of output that you need...
A Donut's Blog
"Bach's Prelude (Cello Suite No. 1) is driving Indiana country roads in Autumn" - Ann Kish
jorgebonafe
Registered User
Posts: 11
Joined: Mon Nov 12, 2007 11:51 pm

Re: Help with editing IMG bbcode

Post by jorgebonafe »

SMR_setLink is irrelevant. Its just I function I dont use anymore.

The thing is there were so many functions on bbcode.php that I coulndt figure out what which one did. So the function that grabs the URL is bbcode_second_pass? Is that also the function that sets the final result that will be sent to the template?
jorgebonafe
Registered User
Posts: 11
Joined: Mon Nov 12, 2007 11:51 pm

Re: Help with editing IMG bbcode

Post by jorgebonafe »

Nevermind, I figured it out.
User avatar
RMcGirr83
Former Team Member
Posts: 22016
Joined: Wed Jun 22, 2005 4:33 pm
Location: Your display
Name: Rich McGirr

Re: Help with editing IMG bbcode

Post by RMcGirr83 »

Care to share? :)
Former Modifications/Extensions Team Member | My extensions | github | All requests for support via PM will be ignored
Appreciate the extensions/mods/support then buy me a beer Image
jorgebonafe
Registered User
Posts: 11
Joined: Mon Nov 12, 2007 11:51 pm

Re: Help with editing IMG bbcode

Post by jorgebonafe »

Well, I gave up. I just opened bbcode.php, copied everything where img appeared on, and created a new bbcode based on that. In the end I didn't change anything, so it still sends the URL, I just made a new bbcode on bbcode.tpl and used the url in a different way.

I gave up because I was trying to resize images with gd, and that wworked fine for most images, but sometimes the code just froze, probably one image was not available. So, I gave up on that code.
Post Reply

Return to “[2.0.x] MOD Writers Discussion”