MyBB Community Forums

Full Version: MyCode problem since 1.8.15
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2 3
It seems there are already some threads about MyCodes issues since class_parser.php has been changed with MyBB 1.8.15.

I do have another issue with following MyCode which is about to resize an image
\[img_noresize\]\[img\](.*?)\[\/img\]\[/img_noresize\]
which will be replaced by
<img src="$1" class="no_resize" />
This MyCode does not work anymore and the image is shown (without being resized) between the MyCode text in the post.

It seems that it is caused by relocattion of this code snippet in the class_parser.php as the MyCode will work once I remove this code snippet where it had been at MyBB 1.8.14. Is this a bug or a feature?
Any proposal to get the MyCode working again?
They have been some updates to the parser in order to fix some issues:
https://github.com/mybb/mybb/pull/3127

You can apply the changes there to see if your issue is fixed.
Thank you for your feedback. I will try to evaluate in the next few days.
The parser updates don't seem to affect this issue, but what does seem to work (at least if/until a more permanent fix is found) is to adjust your regex to something like:

\[img_noresize\]<img\ssrc="([^"]+)"\salt="([^"]+)"\sclass="mycode_img"\s\/>\[/img_noresize\]

as replaced by something like:

<img src="$1" alt="$2" class="no_resize" />
Sorry for coming back a bit late but thank you all for your feedback!
(2018-05-13, 06:52 PM)Omar G. Wrote: [ -> ]You can apply the changes there to see if your issue is fixed.
I've tried to get along with the discussion and all the proposals made on Github but it seems that actually none of the code changes worked for me. Undecided

(2018-05-20, 06:53 AM)Laird Wrote: [ -> ]The parser updates don't seem to affect this issue, but what does seem to work (at least if/until a more permanent fix is found) is to adjust your regex to something like:
Thank you for your proposal, Laird, Unfortunetaly, it doesn't work too. The image will not be resized anymore - which is good - but around the image there is placed a [no_resize] and [/no_resize]
(2018-05-26, 09:10 AM)Jockl Wrote: [ -> ]Thank you for your proposal, Laird, Unfortunetaly, it doesn't work too. The image will not be resized anymore - which is good - but around the image there is placed a [no_resize] and [/no_resize]

Oh, that's odd - it works fine for me. I guess there's some difference between our systems.
It's even worse..... Undecided

After reloading the site with STRG+F5 your code is still resizing the image and adding the mycode as text.... *cyring*
Hmm. Something I noticed in your earlier post which might have been a typo is that you said "around the image there is placed a [no_resize] and [/no_resize]". But earlier (and which my regex assumed) you'd written the tag not as [no_resize] but as [img_noresize]. Could this be the problem?
Blush Blush Blush  shame on me! You're completely right and I messed it up completely.

You're code is working!   ....although I have to admit that I don't know why Wink
Glad to hear your problem's solved!

(In case you want to know why it works, here's an explanation:

The changes in the order of parsing mean that custom MyCodes are now parsed *after* native [img] tags, so now, by the time your custom [img_noresize] tag is parsed, the inner [img] tag has already been converted into its equivalent, post-parsing, HTML tag. So, rather than matching the MyCode [img] tag as the inner tag within the outer [img_noresize] tag, the new regex now matches the post-parsing HTML <img> tag as the inner tag within the outer [img_noresize] tag.

Then, just because it seemed useful, I also added a match as $2 for the "alt" tag which seems to be auto-generated by the parser, and that gets carried over to the final <img> tag.)
Pages: 1 2 3