By Philippe on Tuesday, 29 August 2017
Posted in General Issues
Likes 0
Views 468
Votes 0
Hello,

In the listings of Groups and Pages, why do not you use _thumbnail.jpg images instead of _large.jpg ?

The thumbnails displayed in the listings are very small, so there is no need for an image with very high resolution.
And especially the size is significantly superior with _large.jpg images, which naturally slowed down strongly the loading of the pages.

For example, for one of the images in your EasySocial demo :
  121 KO for _thumbnail.jpg
  1100 KO for _large.jpg

Thank you
Philippe
Hm yeah you are right. We probably missed this! Since most of the time cards aren't using a large width, it should just use the thumbnail version of the cover instead.
·
Tuesday, 29 August 2017 00:14
·
0 Likes
·
0 Votes
·
0 Comments
·
Ah okay my bad! The thumbnails are just too small to fit into the card. Because thumbnails are square, this is why we don't use the thumbnails
·
Tuesday, 29 August 2017 00:16
·
0 Likes
·
0 Votes
·
0 Comments
·
Depending on the template used, the size of the cards varies. And you're right, with the template Echo, it's sometimes a bit just according to the original images. But for your demo, it would be invisible.

Personally to adapt to the Echo template (especially because of the very large and wide cover), I changed the values in :
administrator/components/com_easysocial/constants.php
And put this :

define('SOCIAL_PHOTOS_THUMB_WIDTH', 712);
define('SOCIAL_PHOTOS_THUMB_HEIGHT', 712);

define('SOCIAL_PHOTOS_LARGE_WIDTH', 2048);
define('SOCIAL_PHOTOS_LARGE_HEIGHT', 2048);

In order to optimize the display on the Retina supports, I also doubled all other values. Because otherwise somes images appear blurry on an iPhone or iPad. Test, you'll see http://easysocial.stackideas.com/albums/88-top-10-free-things-to-do-in-amsterdam

To return to the subject, please can you tell me which file I have to modify to display _thumbnail.jpg images in Groups and Pages listings ?

Thank you Mark.
Philippe
·
Tuesday, 29 August 2017 00:38
·
0 Likes
·
0 Votes
·
0 Comments
·
You can modify on this file -> JoomlaFolder/administrator/components/com_easysocial/tables/cover.php


// line 287
$uri = $photo->getSource('large');

// Replace with
$uri = $photo->getSource('thumbnail');


So on these cluster listing page (Group/Page/Event) will show thumbnail image.
·
Tuesday, 29 August 2017 12:51
·
0 Likes
·
0 Votes
·
0 Comments
·
Thank you Arlex. It works for Listing but also in Group and Pages Covers

I would like to display _thumbnail only in the listing.
And the _large.jpg in the Covers.

Thanks
·
Tuesday, 29 August 2017 17:25
·
0 Likes
·
0 Votes
·
0 Comments
·
It seems like that cluster single page also call the same method, perhaps you can try replace my following code and see how it goes.


public function getSource($size = SOCIAL_AVATAR_MEDIUM, $absolute = true)
{
// Get config
$config = ES::config();

// Set the default cover
$default = SOCIAL_JOOMLA_URI . $config->get('covers.default.' . $this->type . '.' . SOCIAL_COVER_DEFAULT);


// If there is a cover override in the template, use it instead.
$app = JFactory::getApplication();
$overridePath = JPATH_ROOT . '/templates/' . $app->getTemplate() . '/html/com_easysocial/covers/' . $this->type . '/default.jpg';

if (JFile::exists($overridePath)) {
$default = rtrim(JURI::root(), '/') . '/templates/' . $app->getTemplate() . '/html/com_easysocial/covers/' . $this->type . '/default.jpg';
}

// Test if the cover is a photo
if ($this->photo_id) {

$photo = $this->getPhoto();

if (!$photo->id) {
$uri = $default;
} else {
$uri = $photo->getSource('large');

$customView = $app->input->get('view');
$customLayout = $app->input->get('layout');

$viewAllowed = array('groups', 'events', 'pages');

// Cluster listing page
if (in_array($customView, $viewAllowed) && $customLayout != 'item') {
$uri = $photo->getSource('thumbnail');
}
}

// The file might not exist, so we need to revert to the default
if($uri === false) {
$uri = $default;
}
} else {
$uri = $default;
}

return $uri;
}
·
Tuesday, 29 August 2017 23:55
·
0 Likes
·
0 Votes
·
0 Comments
·
It works perfectly now !!

By displaying _thumbnail.jpg rather than _large.jpg in Listings Pages and Groups, with tools.pingdom.com, I could see that the size of the page changes from :
6.8 MB to 3.1 MB

It's worth it !
Thanks very much Arlex !!
·
Wednesday, 30 August 2017 00:12
·
0 Likes
·
0 Votes
·
0 Comments
·
You are most welcome. Glad to hear that your issue has been resolved now.

As a gentle reminder, kindly start a new thread if you have any other issue in the future so it will be easier for us to manage your inquiry. I will lock and mark this thread as resolved.
·
Wednesday, 30 August 2017 09:48
·
0 Likes
·
0 Votes
·
0 Comments
·
View Full Post