Image Sizing


#1

I am having issues with the default image sizes. The thumbnail and the image size used on the activity stream both crop to a strange size. It chops off random parts of the image rather than scaling. Please help.

It looks like the sizes are all created on import, but I am wondering why they don't scale to those sizes rather than create the actual images in fixed sizes.

Thanks


#2

Well we’re using WordPress’ default functionality for generating thumbnails, it resizes and crops the image to get the size we ask for. We just have set the size according to the other media sizes so that they can align properly.


#3

So is there a way to override it to make it scale instead of crop? Instead of asking for a specific size, or is it not something that can be modified?

Thanks for the quick response.


#4

About the crop, WordPress automatically do “Soft proportional crop mode” to match the aspect ratio, even when we declare not to crop. Though we can simply remove the image sizes added by the plugin(or change them to a larger size)

function custom_media_thumbnail() {  
add_image_size('bp_media_activity_image', 640, 480, false);  
add_image_size('bp_media_single_image', 800, 600, false);  
}  
add_action('after_setup_theme', 'custom_media_thumbnail',20);  

Activity image size can be different from the single image size and you can define them both in here. Add this function anywhere in your theme that you are using and then it will work. Just change the values to what you need


#5

Thank you very very much!


#6

Ok, one more question. I added that code in and it is working for the activity size and the single image size, but the thumbnail won’t adjust regardless of the size I set. It doesn’t look like in the code you sent that it is setting a thumbnail size, but it could be that I am doing something wrong.

function custom_media_thumbnail() {
add_image_size(‘bp_media_activity_image’, 640, 480, false);
add_image_size(‘bp_media_single_image’, 800, 600, false);
}
add_action(‘after_setup_theme’, ‘custom_media_thumbnail’,20);


#7

Well, there’s no control over the thumbnail size, they’re the default WordPress thumbnails. We’ll soon add more controls over the way things get displayed in BuddyPress Media plugin but till then you’ll have to go with the WordPress’ thumbnails.


#8

Ok. Thank you again for the help.


#9

Hello,

Following on from this information - in my activity feed, BP Media is using the medium size WP images.

How do I tell BP Media to use thumbnail in the activity feed? What code do i need to change ?

Example: http://www.racecraftmodels.co.uk/activity/

With thanks in advance
Monkfish


#10

HI @monkfish

I’ve seen that you’ve applied a modified theme on your site, so you can add this code in that theme’s functions.php file. After that you should use Regenerate Thumbnail plugin to regenerate the thumbnails created earlier.


#11

hello @gagan

Apologies, but i am now confused. I added the code quoted above to the functions.php file of my theme and uploaded new images to my media to test.

Now all image in the activity feed are even bigger.

However, a member also uploaded several image to an album and in the activity feed, they were displayed as thumbnails (50x50) as set in my WP settings.

What have i missed ? i attached a screen grab so you can see .

Attachment Link(s):

http://rtcamp.com/wp-content/uploads/rtMedia/topics/16407/2012/12/image-activity.jpg


#12

@monkfish

In the line

add_image_size('bp_media_activity_image', 640, 480, false);  

you should replace 640 and 480 with the width and height of the image you need in the activity feed respectively.
The last parameter “false” is to disable cropping, for you to get exact image size as you have entered is to set it to “true”.


#13

According to the picture you’ve attached, you need to replace 640 and 480 by 50 and 50, and the false by true, then you’ll get exactly 50 by 50 pixel images on all activity feeds by the plugin.


#14

Hi @gagan,

Perfect ! Thank you. Great assistance, apologies for the confusion.
Monkfish


#15

Is there an update for this? I searched for bp_media_activity_image in 3.1.4 but nothing came up and trying the above mentioned code isn't working.

Nevermind, looks like it switched over to rt_media_activity_image now :)


#16