MyBB Community Forums

Full Version: Reformat the [img] tag?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
Reformat the [img] tag?

where can i reformat this tag or any of the standard tags

thanks
AdminPHP->Configuration->MyCode->Add New MyCode

There you can set a new MyCode. I'm not sure whether it is possible to change existing basic built-in MyCodes without making core changes. I did try it, and it was accepted. But the changes were not effectuated.
where is it located please Toungue
Sorry, typing error:

AdminCP->Configuration->MyCode->Add New MyCode
(2015-02-06, 07:47 AM)Ad Bakker Wrote: [ -> ]AdminPHP->Configuration->MyCode->Add New MyCode

There you can set a new MyCode. I'm not sure whether it is possible to change existing basic built-in MyCodes without making core changes. I did try it, and it was accepted. But the changes were not effectuated.

Adding the same MyCode than a built-in one will override the definition.

I've tested with the IMG code:
regexp:
\[img\](.*?)\[/img\]

Replacement:
<img src="$1" style="border: 2px dotted red;" />

When activated, all the pictures in posts are bordered.
does it use the RTE settings of height and width?
It does. The .scaleimages class is applyed on the div of the post, so all images have a max-width at 100% (of the container)

EDIT I think I didn't understood "the RTE", if you mean adding the =WIDTHxHEIGHT parameter, it didn't
it doesnt actually replace, if you you use the RTE , the old IMG tag is used

SO how do i specify the $2, $3 etc for the width, height, caption etc?
(2015-02-06, 11:46 AM)Crazycat Wrote: [ -> ]Adding the same MyCode than a built-in one will override the definition.

I suspect I made an error in the test then Sad . Good to know this also works!!
(2015-02-06, 12:17 PM)expat Wrote: [ -> ]it doesnt actually replace, if you you use the RTE , the old IMG tag is used

SO how do i specify the $2, $3 etc for the width, height, caption etc?

You need several MyCode, like:
Regexp : \[img width=([0-9]{1,3})\](.*?)\[/img\]
Replacement: <img style="width: $1px;" src="$2" />

Regexp : \[img height=([0-9]{1,3})\](.*?)\[/img\]
Replacement: <img style="height: $1px;" src="$2" />

Regexp : \[img width=([0-9]{1,3}) height=([0-9]{1,3})\](.*?)\[/img\]
Replacement: <img style="width: $1px; height: $2px;" src="$3" />

And so long.

NB: the height parameter is dummy, on a board the width is more important.

NB2: I think (I'm sure) there is a better way to have optionnal parameters than multiplying the MyCode, but I didn't look a lot at how to do that.
Pages: 1 2