MyBB Community Forums

Full Version: Image Size & Align Help
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I'm trying to create an expression that allows users to size and align an image in the same instance.

Regular Expression:
\[img width=(.*?) align=(left|center|right)\](.*?)\[/img\]

Replacement:
<img src="$3" width="$1" align="$2" />

When I insert the mycode as such:
[img width=100 align=right]IMG URL HERE[/img]

Everything looks great. It works. Awesome.

When I go back to edit my post, I see this:
[img=100x100]IMG URL HERE[/img]

For some reason, the align is getting dropped and the width is becoming something else.

What am I missing here?
I guess because IMG mycode is assigned as non editable default MyBB MyCode you can give it different expression to check is it really working.
Switching it over to be "image" instead of "img" helped retain the styling! Thank you.
weird, the custom one is supposed to override the default