BuddyBoss Home – Web › Support Forums › Solutions › Social Learner › How to make Sensei course images square?
Tagged: Sensei images
How to make Sensei course images square to fit the product images?
i.e. 350×350 for single course page,
and scaled smaller, but still square on the course overview pages?
And: How to remove the red thin border around the course image in the courses overview?
I have search for 10 minutes now and cannot find the element.
Square would be nice. Thank you for the question 🙂
Hi @rugwarrior and @nmschaller, you can add this function is child theme fucntions.php
function child_theme_setup() {
add_image_size( 'course-archive-thumb', 360, 360, true );
}
add_action( 'after_setup_theme', 'child_theme_setup', 11 );
after addition of function you will need to regenerate the thumbnails
you can use https://wordpress.org/plugins/regenerate-thumbnails/ plugin to regenearte them.
Regards
Varun Dubey
Hello @vapvarun,
I have installed the plugin from Viper007Bond and regenerated a thumbnail for a test.
Works only on the course archive page generated by your BuddyBoss Sensei plugin, but not on other pages:
– single course page
– page “New courses” /course automatically generated by Sensei.
Also, when I go into the media file in the media library, irritatingly, the thumbnail is still shown in the old format.
There are so many image settings for Sensei images in the sensei settings; I really don’t know what I shall put in there to fit your theme.
Correction: Works also on the New Courses /course page, but not on the single course page
Hi @nmschaller, I have provided the codes for the archive only for the single one, keep the width same else we will also need to alter the css
update with old code with following and regenerate them once more
function child_theme_setup() {
add_image_size( 'course-archive-thumb', 360, 360, true );
add_image_size( 'course-single-thumb', 472, 472, true );
}
add_action( 'after_setup_theme', 'child_theme_setup', 11 );
Regards
Varun Dubey
Do I need to take 472x472px? I have now created all product images in 450x450px and want to reuse them for course pictures – that is the point in making them square.
you can try with 450*450, might be it need some minnor adjustment
Regards
@vapvarun
It does not work. I have tried it with 450, 450 and with the original code above.
All thumbnails are back to original ratio. No square.
Is the code correct? Can I separate it in two? What does the 11 mean?
Hi @nmschaller, 11 is the priority as those are already defined in plugin codes thus i am overriding them with higher priority.
Save them and then regenerate thumbnails
Regards
@vapvarun
How annoying! Now everything is back to how it was before (non-square).
While the code from yesterday for the course archive was working in the custom functions.php, now it is not working anymore. Nor is the code from today. I have also changed the Sensei settings to make the single course image size fit your code. No change.
What shall I do?
Hi @nmschaller, i will pass this to developers. I will post their response.
Regards
Please provide code for original file size = max. single course image size of 450×450 px. Thank you.
@vapvarun
What I am wondering:
There are settings in Sensei settings to create course archive images and single course images in a certain thumbnail size – with our without hard cropping.
I am now using without hard cropping for both product and course images.
And from my attempts to change the image display via CSS, my understanding that this is rather a matter of the image mask on the course archive and single course page.
So why add further images sizes via functions.php at all?
And while it may make sense to define the original file size of 450x450px as another thumbnail size, I wonder why it is “added” as an image size as it already exists.
I just hope that the wordpress database is cleared of previous thumbnails. Not that the images are piling up in my database every time I regenerate thumbnails.