Code to add [img align=right] and [img align=left] to bbcode

This bbcode is using in xoops in others cms..

    '#\[img align=right]([\w:;&,~%+!=@\/\.\-\#\?]+)\[/img(?::\w+)?\]#si' => '<img src="\\1" alt="" align="right" class="bb-image" />',
    '#\[img align=left]([\w:;&,~%+!=@\/\.\-\#\?]+)\[/img(?::\w+)?\]#si' => '<img src="\\1" alt="" align="left" class="bb-image" />',

Add this code next to this line(107):
// Images without or with client-side sizing

CommentFileSizeAuthor
bbcode1.png47.81 KBint

Comments

int’s picture

put also the [img align=center]

naudefj’s picture

Priority: Normal » Minor

Try the following:

[float=right][img]http://upload.wikimedia.org/wikipedia/en/0/0b/Drupallogo.png[/img][/float]

int’s picture

yes, this are two tag instead only one.

And i'm add this to my bbcode filter because, my data from xoops cms, use this style of align.

naudefj’s picture

Please test this regex. If it works I will add it to the module:

'#\[img align=(left|right|center)(?::\w+)?\]([\w:;&,~%+!=@\/\.\-\#\?]+)\[/img(?::\w+)?\]#si' => '<img src="\\2" alt="" align="\\1" class="bb-image" />',

naudefj’s picture

Assigned: Unassigned » naudefj
Status: Needs review » Fixed

Added to CVS.

Anonymous’s picture

Status: Fixed » Closed (fixed)
int’s picture

Status: Closed (fixed) » Active

"Added to CVS."

I donwload the CVS version and don't have this new tag..

naudefj’s picture

Well, it's definitely in CVS. As proof, look at http://cvs.drupal.org/viewcvs/drupal/contributions/modules/bbcode/bbcode...

Are you sure you've downloaded the CVS version???

naudefj’s picture

Status: Active » Fixed
Anonymous’s picture

Status: Fixed » Closed (fixed)