1
incama
Assign bb code [img] to a class
  • 2005/3/12 12:37

  • incama

  • Friend of XOOPS

  • Posts: 513

  • Since: 2003/10/24


Is there a way to assing the bbcode [img] to a class or id, so I can control it in my stylesheet.

The problem I have is that when people post a large image on my forums it wrecks apart my site. I can handle the the post itself, telling when a certain width is crossed it has to overflow, but the overflow needs a width parameter so it knows when to overflow.
Doing this makes pics [img] indeed fit into the page, but, if a post has a smilie in it, the smilie grows until the max width.

So, what I want to do is assing the bbcode [img] to a class so I can control it.

Any one?

2
Mithrandir
Re: Assign bb code [img] to a class

not a bad idea - look at the xoopsCodeDecode() method of the textsanitizer in class/module.textsanitizer.php

$patterns[] = "/[img align=(['"]?)(left|center|right)\1]([^"()?&'<>]*)[/img]/sU";
$patterns[] = "/[img]([^"()?&'<>]*)[/img]/sU";
$patterns[] = "/[img align=(['"]?)(left|center|right)\1 id=(['"
]?)([0-9]*)\3]([^"()?&'<>]*)[/img]/sU";
$patterns[] = "/[img id=(['"]?)([0-9]*)\1]([^"()?&'<>]*)[/img]/sU";
if (
$allowimage != 1) {
    
$replacements[] = '<a href="\3" target="_blank">\3</a>';
    
$replacements[] = '<a href="\1" target="_blank">\1</a>';
    
$replacements[] = '<a href="'.XOOPS_URL.'/image.php?id=\4" target="_blank">\4</a>';
    
$replacements[] = '<a href="'.XOOPS_URL.'/image.php?id=\2" target="_blank">\3</a>';
} else {
    
$replacements[] = '<img src="\3" align="\2" alt="" />';
    
$replacements[] = '<img src="\1" alt="" />';
    
$replacements[] = '<img src="'.XOOPS_URL.'/image.php?id=\4" align="\2" alt="\4" />';
    
$replacements[] = '<img src="'.XOOPS_URL.'/image.php?id=\2" alt="\3" />';
}

Add the CSS class to the replacements and it should work.

3
incama
Re: Assign bb code [img] to a class
  • 2005/3/12 12:58

  • incama

  • Friend of XOOPS

  • Posts: 513

  • Since: 2003/10/24


Thank you very much Mithrandir,.I'll play with this and will post my results.

Dave

Login

Who's Online

137 user(s) are online (94 user(s) are browsing Support Forums)


Members: 0


Guests: 137


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Apr 30
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits