s9e Media BBCodes pack

s9e Media BBCodes pack 20231102

No permission to download
Yup, only albums at the moment. I'm still torn about including images. I understand that some people post URLs as text and expect them to turn into images. On the other hand, I'm afraid it could introduce some inconsistencies. For instance, it sidesteps XenForo's proxy. Assuming XenForo can manage permissions related to the use of the IMG tag, that wouldn't be the case here. And it would be rendered using a different HTML code too, making images embedded via Imgur look different from the same image included with the IMG tag.

Ultimately, I think I will end up turning Imgur links into images. But currently I still have reservations and since images already have a BBCode it doesn't seem like a pressing matter, that's why I feel I can take more time to make a better informed decision.

take your time man, it's really no biggie. i'd rather keep to XF's proxy than have imgur images auto embed. thank you for your hard work!
 
Awesome. A query... I want to change the way YouTube embed work right now. Users have complained that they need to click on the video to see how long it is. My audience (and me) are from India and a lot of people are usually on limited bandwidth plans. Clicking the video starts the buffering process which basically eats up bandwidth if you decide not to watch the video at all.

I guess I can edit the MediaBBCodes.php before uploading to edit the YouTube code. Just wanted to know if there is any specific reason why you decided to embed YouTube videos the way they are embedded right now! Thanks.
 
Joshy is there a way to embed a Youtube video and mark the spot where you want it?

For example, when posting a YouTube video, you can embed time code so that video plays from that position.

It's done with "t=" parameter. For example: "t=10m26s" would play from that time position.
 
It works out of the box with numeric values, e.g.
Code:
http://www.youtube.com/watch?v=H_w-O4RNu1A#t=48

It might not support letters. In your case you'd have to edit the URL to replace 10m26s to 626.
 
Last edited:
It works out of the box with numeric values, e.g.
To view this content we will need your consent to set third party cookies.
For more detailed information, see our cookies page.

It might not support letters. In your case you'd have to edit the URL to replace 10m26s to 626.
ah that explains why it works for me in some videos and not in all.
 
Righto. I wish YouTube at least loaded a better quality preview image because currently it uses a very low quality one. Any instructions for how I can change it on my own board. I understand that it would have to be done after every update. Thanks!
You could open library/s9e/MediaBBCodes.php and replace controls=2 to controls=1 I guess. Not sure about that one.
 
Seems to work. I wonder if you can add this as an option in the same setting where you offer Amazon Associate Tag and Exclude Sites. :p
 
Wow, you ask how to do something and not only does Joshy take time to explain he also updates his add on to include it. amazing work brother, my hat off to you.
 
Seems to work. I wonder if you can add this as an option in the same setting where you offer Amazon Associate Tag and Exclude Sites. :p
Technically, yes but that adds to my maintenance costs and I'm looking for a more scalable solution. If you want a permanent solution, currently your best option would be to create your own embed callback and put YouTube in the list of sites not to update.

First you'll have to save the following PHP file as Custom.php in the same dir as MediaBBCodes.php
PHP:
<?php

class s9e_Custom
{
    public static function embedYoutube($mediaKey, $site)
    {
        $html = s9e_MediaBBCodes::embed($mediaKey, $site);

        return str_replace('controls=2', 'controls=1', $html);
    }
}

Then edit the YouTube media site, go to Advanced Options and change this setting:
Code:
Embed HTML Callback: s9e_Custom :: embedYoutube
 
Last edited:
JoshyPHP updated s9e Media BBCodes pack with a new update entry:

Added experimental support for custom HTML modifications via callbacks

If you don't want to modify any HTML, ignore this update. But if you use this feature, tell me about it or it might be removed in a future version.

Create a PHP file named upload/library/s9e/Custom.php and create a method for each media site that you want to modify. For example:
PHP:
<?php

class s9e_Custom
{
    public static function mixcloud($html)
    {
        return preg_replace('((width|height)="\d+")', '$1="500"', $html);
    }

    public static function...

Read the rest of this update entry...
 
I see you are trying to incorporate my YouTube request here! Thanks for giving it a try. :)
Yes, just forget my first post and do the thing described in the update minus the part about MixCloud. It'll do what you need.

And also, I'd like to mention that if this feature stays it will replace this previous attempt at customization (the second bullet point, not the first.) I don't think anybody uses it and it can be replaced with a custom callback anyway.
 
Yes, exactly as written. You can copy/paste it from the text here.

Code:
/php/xenforo $ cat upload/library/s9e/Custom.php
<?php

class s9e_Custom
{
        public static function youtube($html)
        {
                return str_replace('controls=2', 'controls=1', $html);
        }
}
 
Top Bottom