By Tim Myers on Monday, 14 March 2016
Posted in Technical Issues
Replies 11
Likes 0
Views 544
Votes 0
Hi. I am using EasyBlog 5.0.30. I am trying to integrate a third party image component (SIM Gallery) to be the "My Media" folder for EasyBlog. In the back-end I changed the folder location to be the SIM Gallery folder with no problem. In the front-end, when I write/edit a post I can go to My Media and see my SIM Gallery folders. The problem I am experiencing are the image thumbnails. EasyBlog uses a different file name structure than SIM Gallery. This means there are incorrect links to the photos in the selected folder, so obviously the image thumbnails do not appear.

So here's my first question: where in the EasyBlog code (specific file with path & line number) are the "b2ap3_thumbnail_" and "b2ap3_icon_" prefixes added to the picture's thumbnail names? I think if I can remove this addition of this prefix to the file names with a hack it should work OK.

My second question regards the query for the user's folder names in My Media: where is the code located (again, specific file with path & line number) that queries the user's folders of images located in the "User Media" directory folder?

Thanks in advance for assisting me in locating this specific coding-

Tim
Thanks for sharing Tim
·
Saturday, 26 March 2016 19:50
·
0 Likes
·
0 Votes
·
0 Comments
·
Hi there Tim,

As for your question, you can refer the picture here b2ap3_thumbnail and b2ap3_icon location

Note: The purple numbers indicate the code line.

I hope this helps with your endeavor. Do notice us on the update on how it goes
·
Monday, 14 March 2016 12:06
·
0 Likes
·
0 Votes
·
0 Comments
·
Thank you. I see the code you reference in the first file (composer-5.0.30.optimized), but I am not clear where the "b2ap3_thumbnail_" is added to the html. That is what I'm seeking.

Later in that function I see this code:

getSourceThumbnailImage: function(url) {

return $("<img>").attr("src", url)[0];
},

Is the "url" reference in this sub-function the thumbnail image link (path and name)?

Thanks again,

Tim
·
Tuesday, 15 March 2016 11:30
·
0 Likes
·
0 Votes
·
0 Comments
·
Hey Tim,

I am sorry for the delay of this reply,

These image prefix "b2ap3_thumbnail_" / "b2ap3_icon_" is actually generated from this file ->
JoomlaFolder\administrator\components\com_easyblog\includes\imageset\imageset.php

// LINE 125
// EBLOG_SYSTEM_VARIATION_PREFIX <- this will generate to this prefix 'b2ap3'
$data->path = $folder . '/' . EBLOG_SYSTEM_VARIATION_PREFIX . '_' . $size . '_' . $fileName;



Hope this will help.
·
Tuesday, 15 March 2016 13:25
·
0 Likes
·
0 Votes
·
0 Comments
·
Thanks but that is not helping with the current task. I don't think I'm being clear, so let me ask a different way.

In the front-end composer view, when I click Add Media, then My Media and then I click on the first folder, the icons of the images in the folder appear. When I inspect element on the first image that is supposed to display, I see this code. Where (path and name) is this html written:


<div class="eb-mm-file type-image ext-jpg" data-eb-mm-file="" data-key="_dXNlcjo1NjIvMS8xMV9kb3dubG9hZC5qcGc-" data-type="image">
<i class="fa fa-file-image-o" style="background-image: url("//triptrackgo.com/images/sg_photos/562/1/b2ap3_icon_XXXXXX.jpg"; );"></i>
<div>
<span data-eb-mm-file-title="">XXXXXX.jpg</span>
</div>
</div>
·
Wednesday, 16 March 2016 09:16
·
0 Likes
·
0 Votes
·
0 Comments
·
Hey Tim,

I am really sorry for the delay of this reply,

Based on your explanation at above, that image path is generate from this following file.
JoomlaFolder\administrator\components\com_easyblog\includes\mediamanager\adapters\abstract.php


// LINE 256 until 260
// Add thumbnail & preview
if ($type=='image') {
$item->thumbnail = $folder->url . '/' . EBLOG_SYSTEM_VARIATION_PREFIX . '_icon_' . $filename;
$item->preview = $folder->url . '/' . EBLOG_SYSTEM_VARIATION_PREFIX . '_thumbnail_' . $filename;
}


Hope this will help.
·
Thursday, 17 March 2016 15:19
·
0 Likes
·
0 Votes
·
0 Comments
·
Great! This was very helpful. I removed the ". EBLOG_SYSTEM_VARIATION_PREFIX . '_icon_' ." and ". EBLOG_SYSTEM_VARIATION_PREFIX . '_thumbnail_' ." code from these lines, and also lines ~340 &341. The icon images now show in the folder!

Unfortunately, when I click one of these "icon" images in the folder, the subsequent screen still does not show the thumbnail of the photo. Also, at the right under the image source box, the tiny image does not display. Are the image paths for these written in a different file? Where are the following code written?

Main Screen
<div class="eb-image">
<div class="eb-image-figure">
<a class="eb-image-viewport"><img src="//triptrackgo.com/images/sg_photos/562/1/b2ap3_thumbnail_XXXXXX.jpg"></a>
</div>
</div>

Image Source (right sidebar)
<div class="eb-image-source-thumbnail" data-eb-image-source-thumbnail=""><img src="//triptrackgo.com/images/sg_photos/562/1/b2ap3_icon_XXXXXX.jpg"></div>


Thank you again for all of your help!

Tim
·
Friday, 18 March 2016 10:10
·
0 Likes
·
0 Votes
·
0 Comments
·
Hey Tim,

Firstly, I really reckon that you shouldn't be modifying the behavior of the media manager altogether. This will cause more complications.

These prefixes ensures that EasyBlog doesn't list them in the media manager as we need to generate multiple versions of an image to ensure that your blog loads without rendering the full sized image.

Should you really need to proceed with this, these are the files that contains the constants EBLOG_SYSTEM_VARIATION_PREFIX

/administrator/components/com_easyblog/includes/mediamanager/adapters/local.php
/administrator/components/com_easyblog/includes/mediamanager/adapters/abstract.php
/administrator/components/com_easyblog/includes/imageset/imageset.php
·
Sunday, 20 March 2016 02:26
·
0 Likes
·
0 Votes
·
0 Comments
·
Thank you for the advice. Given what you said in this last reply, I may try a slightly different approach. If it works, I will post the outcome and hacks here.......it may take a few days

Thanks again- Tim
·
Wednesday, 23 March 2016 09:53
·
0 Likes
·
0 Votes
·
0 Comments
·
Hey Tim,

That's exciting to know! Do inform us of the outcome!
·
Wednesday, 23 March 2016 10:45
·
0 Likes
·
0 Votes
·
0 Comments
·
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;
·
Friday, 25 March 2016 22:43
·
0 Likes
·
0 Votes
·
0 Comments
·
View Full Post