Skip to:
Content
Pages
Categories
Search
Top
Bottom

Reduce size of embed Media


  • Leonyipa
    Participant

    @leonyipa

    After I checked

    Embed media (YouTube, Twitter, Flickr, etc…) directly into topics and replies

    My users are allow to post a link in a post, and it become a video immediately.
    How to resize the youtube video and make it smaller?

    This really helps a lot as I hope to reduce lag in my forum where people keep posting youtube videos.

    Thanks!

Viewing 15 replies - 1 through 15 (of 15 total)

  • Leonyipa
    Participant

    @leonyipa

    In addition, how to set a maximum width for </img> images?


    Leonyipa
    Participant

    @leonyipa

    please help!


    Leonyipa
    Participant

    @leonyipa

    thanks,

    no, what I mean is setting a stand size for ALL embed youtube videos in BBPress


    Robkk
    Moderator

    @robkk

    not sure but you probably have to set a max width for oembed embeds

    http://www.wpbeginner.com/wp-themes/how-to-set-oembed-max-width-in-wordpress-3-5-with-content_width/

    add the code to your functions.php in your child theme.

    change 600 to whatever number you want as the width, im sure you could copy the function to width to height and also do the height to.

    if the code doesnt work , look at the comments and try that user posted code. (i havent tried any of these codes so i dont know if they work really, if they dont just delete the function from your child functions.php)

    for images (using img quicktag) i think you can use css

    #bbpress-forums div.bbp-reply-content img, #bbpress-forums div.bbp-topic-content img {
    max-width: 100%;
    height: auto;
    }

    for images (posted by link using oembed , imgur , flickr picture, instagram picture) the oembed code that i linked to should do the same for these.


    Leonyipa
    Participant

    @leonyipa

    Thanks very much @Robkk!!

    The youtube video worked!!! I have been looking for the solution for a long time, thanks!
    The maximum width of youtube video works really well!!

    However, when I change the code to height, it doesn’t work πŸ™

    Also for the image, I edited the css
    because I am using BBPress Default Theme, it doesn’t have a .css and tell me to edit function.php instead
    And I paste the code into: /public_html/wp-content/themes/bp-default/functions.php

    #bbpress-forums div.bbp-reply-content img, #bbpress-forums div.bbp-topic-content img {
    max-width: 100%;
    height: auto;
    }

    but no matter what I change the number, it is still set to 100%.
    Did I add the code to the wrong place? or it’s not working?


    Leonyipa
    Participant

    @leonyipa

    I also found the code is in
    /public_html/wp-content/plugins/bbpress/templates/default/css/bbpress.css

    I directly change the number of

    #bbpress-forums div.bbp-topic-content img,
    #bbpress-forums div.bbp-reply-content img {
    max-width: 100%;
    }

    However, no matter what number I change to, it still doesn’t work.
    The width of the image still remain 100%


    Robkk
    Moderator

    @robkk

    @leonyipa ok great on the youtube video width , at least the code is doing something

    there is probably another function on the web that i can direct you to if i find something that works on both height and width, so wait til i come back with a function that works for both

    if i give you a new function delete the old one

    paste codes into a child themes functions.php and style.css so that the code wont disappear during theme upgrades

    and dont edit the core files inside of bbpress
    copy those files into your child theme so you can be safe on bbpress plugin upgrades

    so copy bbpress.css to your child theme, if you dont have a child theme , make one they are great for customizing your bbpress install

    for more about customizing bbpress with css , plugins, and functions read this

    Step by step guide to setting up a bbPress forum – part 2


    Leonyipa
    Participant

    @leonyipa

    thanks πŸ™‚


    Robkk
    Moderator

    @robkk

    here use this code instead and remember put this into your functions.php in your child theme
    change the numbers to whatever you want

    add_filter('embed_defaults','themename_embed_defaults');
    function themename_embed_defaults($defaults) {
       $defaults['width']=500;
       $defaults['height']=250;
       return $defaults;
    }

    Leonyipa
    Participant

    @leonyipa

    Thanks very much!!! It worked πŸ™‚

    Do you know how to set maximum size for image?

    Thank you!!!!!!!!!!


    Robkk
    Moderator

    @robkk

    change the numbers to whatever you want

    #bbpress-forums div.bbp-reply-content img, #bbpress-forums div.bbp-topic-content img {
    max-width: 500px;
    max-height:250px;
    height: auto;
    }

    you add this into anywhere where you can have custom css

    in bbpress.css in your child theme(you copy the original in your child theme)
    in your child themes css stylesheet
    the jetpack plugin module custom css
    a standalone custom css plugin


    Leonyipa
    Participant

    @leonyipa

    yes, but it doesn’t work πŸ™

    I also found the code is in
    /public_html/wp-content/plugins/bbpress/templates/default/css/bbpress.css

    I directly change the number of

    #bbpress-forums div.bbp-topic-content img,
    #bbpress-forums div.bbp-reply-content img {
    max-width: 100%;
    }
    However, no matter what number I change to, it still doesn’t work.
    The width of the image still remain 100%


    Robkk
    Moderator

    @robkk

    to test out the code make pictures really small and add important

    #bbpress-forums div.bbp-topic-content img, #bbpress-forums div.bbp-reply-content img {
        max-width: 100px!important;
        max-height: 50px!important;
    }

    but you could also send me a link to a forum post with a picture too


    Leonyipa
    Participant

    @leonyipa

    it still doesn’t work πŸ™
    I set the max-width: 100px and max-height 50px
    but the picture is still very large.

    Link: http://gleam.tk/groups/forum-games/forum/topic/a-z-animals/page/3/#post-1337

    @leonyipa Don’t get you bb’s confused, what you wrote way up there and quoted here:

    And I paste the code into: /public_html/wp-content/themes/bp-default/functions.php

    That is the BuddyPress Theme ‘BP Default’, nothing to do with bbPress so make sure you are updating the correct files πŸ˜‰

Viewing 15 replies - 1 through 15 (of 15 total)
  • You must be logged in to reply to this topic.
Skip to toolbar