By Mist on Tuesday, 08 April 2014
Replies 0
Likes 0
Views 2.1K
Votes 0
For all of you that are using EasySocial together with EasyBlog and you may want to load the EasySocial profile object instead of EasyBlog's profile object, in order to get bigger author avatar picture in blog posts. This is how you can do it.

First of all, it's obvious, that you will create a template override for blog.avatar.php file in your joomla template's overrides folder, the right path is shown below
/templates/your_template/html/com_easyblog/blog.avatar.php

So just copy the original blog.avatar.php into this location.

Now, inside blog.avatar.php find the following

<?php echo $row->blogger->getAvatar(); ?>


and replace it with

<?php echo Foundry::user($row->blogger->id)->getAvatar(SOCIAL_AVATAR_LARGE);?>


You will have to replace this twice, in 2 separate places, at line 22 & 26

Now, you can use the various avatar sizes inside your code as specified in EasySocial documentation.
Just replace "SOCIAL_AVATAR_LARGE" from within the above code with your desired option from below examples.

SOCIAL_AVATAR_SMALL - Smallest version of avatar. Dimensions: 32 x 32
SOCIAL_AVATAR_MEDIUM - Medium version of avatar. Dimensions: 64 x 64
SOCIAL_AVATAR_SQUARE - Large square version of avatar. Dimensions: 180 x 180
SOCIAL_AVATAR_LARGE - Large version of avatar. Dimensions: 180x (y) (This is a proportionate size)

Depending on your scenario, you may want to aditional control the output of the image by adding height and width sizes to the image code.

In my case i needed an image of 120x120, so i used "SOCIAL_AVATAR_SQUARE" option to pull an image with 180x180 size from EasySocial and then scale it down to 120x120 by adding custom width and height to img tag.

Enjoy !
View Full Post