Is myBB parsing &hash=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx - Printable Version +- MyBB Community Forums (https://community.mybb.com) +-- Forum: Extensions (https://community.mybb.com/forum-201.html) +--- Forum: Plugins (https://community.mybb.com/forum-73.html) +---- Forum: Plugin Development (https://community.mybb.com/forum-68.html) +---- Thread: Is myBB parsing &hash=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx (/thread-185099.html) |
RE: Is myBB parsing &hash=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx - SentoWeb - 2015-10-17 (2015-10-17, 02:03 AM)Destroy666 Wrote:(2015-10-16, 09:10 PM)SentoWeb Wrote: Please note that doing so will result in a big performance issue. From what I understand the OP wants to load URLs without actually wrapping them in an IMG tag which would mean that this is executed every time the post is parsed (so basically a MyCode which looks for links). I argued for a PHP solution which just wraps the url in an image tag after the content is posted which is way more efficient and also results in more efficient MyCode parsing. This solution can be used by a forum of any size. The "it doesn't hurt me now" argument is a bad excuse for creating future problems. (2015-10-16, 09:44 PM)Thomas131 Wrote: I would say that my Regex is about as cpu/memory-using as the default URL-Tag-Parser. (Maybe even less because I used ?: a lot of time to not save match-patterns) I really don't think that he will run into performance issues. There is definitly a reason, why MyCodes are Regexes ... Yes, never argued with that. The solution you provided is the easiest to set up and it is as efficient as anything else using regex. I suggested a different approach because long-term the OP will want more efficient way of doing this, and perhaps even check if the URL actually returns image headers and whatnot. RE: Is myBB parsing &hash=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx - expat - 2015-10-17 (2015-10-16, 08:10 PM)SentoWeb Wrote: Its a bit more complicated but still possible. Basically you want to make use of the content creation hooks and parse the content. Something like this is a good starting point: Its never too late to learn BUT if you can get one working sample and where i would call it, i be happy to give it a shot By the way, why wrap it in a IMG tag when you cannot use PHP there? RE: Is myBB parsing &hash=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx - Tom K. - 2015-10-17 Moved this to plugin development - makes more sense here RE: Is myBB parsing &hash=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx - SentoWeb - 2015-10-17 (2015-10-17, 09:07 AM)expat Wrote:(2015-10-16, 08:10 PM)SentoWeb Wrote: Its a bit more complicated but still possible. Basically you want to make use of the content creation hooks and parse the content. Something like this is a good starting point: The idea is to use PHP to wrap it in IMG tags after the content was posted. You can do additional checks there, like check the headers and make sure that this is indeed an image file. You could additionally put a class there to give images a different treatment. The idea is to identify images after the content was posted instead of running a regex (mycode) every time the post content is parsed. If you want a solution which is quick to set up the regex one posted by Thomas131 is the way to go though. RE: Is myBB parsing &hash=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx - Thomas131 - 2015-10-17 I will say goodbye from this thread. I have posted a solution, but I don't have additional time. God Bless you! Thomas131 RE: Is myBB parsing &hash=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx - expat - 2015-10-17 thanks all for your help, some new concepts I still grasping with. DIDnt someone say the posted content is cached? So when you post something, regex runs thru the post and its cached.... How can i then change it on the fly and cache again? Very nice concept PS. I think I know what you are trying to do, is changing the [ URL ] into the [ IMAGE ] ?? Question is why? when you can skip the clunky REGEX and display the image anyway you wished, since you already located the image link RE: Is myBB parsing &hash=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx - Thomas131 - 2015-10-17 I'm just locating image-URLs and displaying this images with my Regex. No Link to [img]link[/img] converting. RE: Is myBB parsing &hash=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx - expat - 2015-10-17 (2015-10-17, 02:11 PM)Thomas131 Wrote: I'm just locating image-URLs and displaying this images with my Regex. No Link to [img]link[/img] converting. yeah, i mean the other chap. If i went your way I would prefer to hack the parser and do an IF clause there and output the image as i wished, rather call it back to myCode again, coz you are search for URL and Image separately twice, rather in the same search RE: Is myBB parsing &hash=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx - Euan T - 2015-10-17 Parsed posts are not cached in 1.x. They are in 2.0. RE: Is myBB parsing &hash=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx - Destroy666 - 2015-10-17 (2015-10-17, 08:00 AM)SentoWeb Wrote: From what I understand the OP wants to load URLs without actually wrapping them in an IMG tag which would mean that this is executed every time the post is parsed (so basically a MyCode which looks for links). I argued for a PHP solution which just wraps the url in an image tag after the content is posted which is way more efficient and also results in more efficient MyCode parsing. This solution can be used by a forum of any size. The "it doesn't hurt me now" argument is a bad excuse for creating future problems. http://bradt.ca/blog/stop-avoiding-regular-expressions-damn-it/ Using several string functions won't make it much faster, if any. Try it yourself and run both code samples 100 times. There won't be any significiant difference. |