So I think I have it working. Let me mention a few things first:
- I am not a professional developer, so I'm sure there are better and more efficient ways to code/hack this.
- I am not using all Easy Blog image functionality on my site, so this probably won't work for adding the small/medium/large variations and adding media from other users.
So here it goes.....
Before hacking files, you need to set EasyBlog’s default User Media folder in the back-end/Admin to be the SIM gallery folder (for my install it was “images/sg_photos/”).
FILE: public_html/components/com_easyblog/themes/wireframe/mediamanager/folder/toolbar/folder.php
This replaces the folder name with SIM Gallery album name in toolbar.
Revise line 28 to:
<strong data-eb-mm-folder-title><?php echo $row[$folder->title]->name; ?></strong>
Add this php to start of file:
$db = JFactory::getDBO();
$profile = CFactory::getRequestUser();
$profile_id = $profile->id;
$db->setQuery( "SELECT #__simgallery_albums.aid, #__simgallery_albums.name FROM #__simgallery_albums
JOIN #__simgallery_media ON #__simgallery_media.typeid = #__simgallery_albums.aid
WHERE #__simgallery_media.type = 'album' AND #__simgallery_media.owner =".$profile->id );
$row = $db->loadObjectList('aid');
FILE: public_html/components/com_easyblog/themes/wireframe/mediamanager/filegroup.php
This replaces folder names with SIM Gallery album names under toolbar after My Media is selected. The extra IF statement also prevents various SIM Gallery file variations from being loaded (so you don’t see previews for 3 or 4 variations of the same image).
Add this php to start of file:
$db = JFactory::getDBO();
$profile = CFactory::getRequestUser();
$profile_id = $profile->id;
$db->setQuery( "SELECT #__simgallery_albums.aid, #__simgallery_albums.name FROM #__simgallery_albums
JOIN #__simgallery_media ON #__simgallery_media.typeid = #__simgallery_albums.aid
WHERE #__simgallery_media.type = 'album' AND #__simgallery_media.owner =".$profile->id );
$row = $db->loadObjectList('aid');
Then revise code in file to be:
<div class="eb-mm-filegroup type-<?php echo $type; ?> <?php echo empty($count) ? 'is-empty' : ''; ?>" data-eb-mm-filegroup data-limit="<?php echo $limit; ?>">
<div class="eb-mm-filegroup-header" data-eb-mm-filegroup-header>
<i class="fa fa-angle-up"></i>
<div class="eb-mm-filegroup-title"><?php echo JText::_('COM_EASYBLOG_MM_FILEGROUP_TYPE_' . strtoupper($type)); ?></div>
</div>
<div class="eb-mm-filegroup-body">
<div class="eb-mm-filelist view-<?php echo $view; ?>" data-eb-mm-filelist>
<?php foreach($files as $i => $file) { ?>
<?php $imagetitle = $file->title;
if (strpos($imagetitle, '_download') == false && strpos($imagetitle, '_output') == false) { ?>
<?php if ($count > $limit && $i==$limit) { ?>
<div class="eb-mm-filegroup-show-all-button" data-eb-mm-filegroup-show-all-button>
<?php echo JText::_('COM_EASYBLOG_MM_SHOW_ALL');?> <span data-eb-mm-filegroup-count><?php echo $count; ?></span> items</div>
<div class="eb-mm-filegroup-more">
<?php } ?>
<?php // For performance reasons (~150ms faster), this is hardcoded. An almost identical copy of can be found at 'site/mediamanager/file' used by renderFile(). ?>
<div class="eb-mm-file type-<?php echo $file->type; ?><?php echo empty($file->extension) ? '' : ' ext-' . $file->extension; ?>"
data-eb-mm-file
data-key="<?php echo $file->key; ?>"
data-type="<?php echo $file->type; ?>">
<i class="<?php echo $file->icon; ?>"
<?php if (isset($file->thumbnail)) { ?>
data-thumbnail="<?php echo $file->thumbnail; ?>"
<?php } ?>></i>
<div>
<span data-eb-mm-file-title>
<?php
if ($type=='folder') {
echo $row[$file->title]->name;
} else {
echo $file->title;
}
?>
</span>
</div>
<?php if ($type=='folder') { ?>
<b class="fa fa-angle-right"></b>
<?php } ?>
</div>
<?php if ($count > $limit && $i==$count - 1) { ?>
</div>
<?php } ?>
<?php } ?>
<?php } ?>
</div>
</div>
</div>
FILE: public_html/administrator/components/com_easyblog/includes/constants.php
Revised line 30 to match the SIM gallery suffix for thumbnails:
define( 'EBLOG_MEDIA_THUMBNAIL_PREFIX' , '_thumb' );
Revised line 178 to prevent prefix added to SIMGallery file names:
define( 'EBLOG_SYSTEM_VARIATION_PREFIX' , '');
FILE: public_html/administrator/components/com_easyblog/includes/mediamanager/adapters/abstract.php
Get rid of extra icon and thumbnail references in file names.
Revised lines 258-259 to:
$item->thumbnail = $folder->url . '/' . EBLOG_SYSTEM_VARIATION_PREFIX . $filename;
$item->preview = $folder->url . '/' . EBLOG_SYSTEM_VARIATION_PREFIX . $filename;
Revised lines 340-341 to:
$item->thumbnail = $folderurl . '/' . EBLOG_SYSTEM_VARIATION_PREFIX . $filename;
$item->preview = $folderurl . '/' . EBLOG_SYSTEM_VARIATION_PREFIX . $filename;
Change order to make Thumbnail prefix into a suffix like SIM Gallery:
Revise line 54:
'|(' . $filename . ')(' . EBLOG_MEDIA_THUMBNAIL_PREFIX . ')/ui';
FILE: public_html/administrator/components/com_easyblog/includes/mediamanager/adapters/local.php
Get rid of extra icon and thumbnail references in file names.
Revised lines 57-58 to:
$item->thumbnail = $folderurl . '/' . EBLOG_SYSTEM_VARIATION_PREFIX . $filename;
$item->preview = $folderurl . '/' . EBLOG_SYSTEM_VARIATION_PREFIX . $filename;
FILE: public_html/administrator/components/com_easyblog/includes/image/image.php
Revised line 363 to make prefix into suffix:
$storagePathThumb = JPath::clean( $folder . DIRECTORY_SEPARATOR . $filename . EBLOG_MEDIA_THUMBNAIL_PREFIX );
FILE: public_html/administrator/components/com_easyblog/includes/image/helpers/imagedata.php
Revised the following to make prefix into suffix
Line 42:
if( JFile::exists( $path . DIRECTORY_SEPARATOR . $file . EBLOG_MEDIA_THUMBNAIL_PREFIX ) )
Line 44:
$thumbFile = $file . EBLOG_MEDIA_THUMBNAIL_PREFIX;
Line 156:
if( JFile::exists( $folder . DIRECTORY_SEPARATOR . $file . EBLOG_MEDIA_THUMBNAIL_PREFIX ) )
Line 158:
$tmp->thumbnail = rtrim( $baseURL , '/' ) . '/' . $file . EBLOG_MEDIA_THUMBNAIL_PREFIX ;
Line 162:
$thumbPath = $folder . DIRECTORY_SEPARATOR . $file . EBLOG_MEDIA_THUMBNAIL_PREFIX;