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 » Mon Mar 10, 2008 8:40 pm

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: 34457
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 » Wed Mar 12, 2008 12:13 am

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 » Wed Mar 12, 2008 12:39 am

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 » Thu Mar 13, 2008 8:47 pm

Nevermind, I figured it out.

User avatar
RMcGirr83
Recognised Extension Developer
Posts: 21034
Joined: Wed Jun 22, 2005 4:33 pm
Location: Your display
Name: Rich McGirr
Contact:

Re: Help with editing IMG bbcode

Post by RMcGirr83 » Fri Mar 14, 2008 1:28 pm

Care to share? :)
In times of change, learners inherit the earth, while the learned find themselves beautifully equipped to deal with a world that no longer exists - Eric Hoffer
Former Modifications/Extensions Team Member | My extensions
Appreciate the extensions/mods/support then buy me a beer
All requests for support via PM will be ignored

jorgebonafe
Registered User
Posts: 11
Joined: Mon Nov 12, 2007 11:51 pm

Re: Help with editing IMG bbcode

Post by jorgebonafe » Fri Mar 14, 2008 5:58 pm

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”