Reduce size of embed Media
-
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!
-
In addition, how to set a maximum width for </img> images?
please help!
thanks,
no, what I mean is setting a stand size for ALL embed youtube videos in BBPress
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.
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?I also found the code is in
/public_html/wp-content/plugins/bbpress/templates/default/css/bbpress.cssI 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%@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 upgradesso 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
thanks π
here use this code instead and remember put this into your functions.php in your child theme
change the numbers to whatever you wantadd_filter('embed_defaults','themename_embed_defaults'); function themename_embed_defaults($defaults) { $defaults['width']=500; $defaults['height']=250; return $defaults; }
Thanks very much!!! It worked π
Do you know how to set maximum size for image?
Thank you!!!!!!!!!!
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 pluginyes, but it doesn’t work π
I also found the code is in
/public_html/wp-content/plugins/bbpress/templates/default/css/bbpress.cssI 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%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
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 π
- You must be logged in to reply to this topic.