SimplePortal
Development => Feature Requests => Applied Requests => Topic started by: Soms on September 17, 2008, 03:25:31 AM
-
Is it possible to add a feature to be able to display random pictures using the photos in the (new) SMF Media Gallery (http://custom.simplemachines.org/mods/index.php?mod=1365) instead of the (old) SMF Gallery (http://custom.simplemachines.org/mods/index.php?mod=473)? Or at least give the choice of choosing between the two or using both?
Keep up the good work!
-
Thats a great idea!!! :D
I am sure that either myself or one of the other devs/customizers will make this block when we get some time.
-
:wave: I too would be very interested in this block. :wave:
BTW - thanks for creating such a great tool!!!
-
I would like to see this aswell.
-
Use this code with a php block, for now:
global $sourcedir, $user_info, $ID_MEMBER, $context, $txt, $galurl, $galurl2, $scripturl, $settings, $db_prefix;
require_once($sourcedir . '/Subs-MGallery.php');
loadMGal_Settings();
if(loadlanguage('MGallery') == false)
loadLanguage('MGallery', 'english');
$request = db_query("
SELECT m.id_media, m.id_member, IFNULL(mem.realName, m.member_name) AS member_name, m.id_thumb, m.title, m.description, m.views, m.rating, m.voters,
a.id_album, a.name, IFNULL(lm.time, 0) < m.log_last_access_time AS is_new, m.time_added, m.type
FROM {$db_prefix}mgallery_media AS m
INNER JOIN {$db_prefix}mgallery_albums AS a ON (a.id_album = m.album_id)
LEFT JOIN {$db_prefix}members AS mem ON (mem.ID_MEMBER = m.id_member)
LEFT JOIN {$db_prefix}mgallery_log_media AS lm ON (lm.id_member = $ID_MEMBER AND lm.id_media = m.id_media)
WHERE $user_info[mgallery_query_see_album]
AND m.approved = 1
ORDER BY RAND()
LIMIT 1", __FILE__, __LINE__);
while ($row = mysql_fetch_assoc($request)) {
$item = array(
'id' => $row['id_media'],
'id_album' => $row['id_album'],
'album_name' => $row['name'],
'item_title' => $row['title'],
'member_name' => $row['member_name'],
'member_id' => $row['id_member'],
'rating' => $row['voters'] != 0 ? ($row['rating']/$row['voters']) : 0,
'voters' => $row['voters'],
'id_thumb' => $row['type'] == 'embed' ? 2 : $row['id_thumb'],
'desc' => $row['description'],
'time_added' => $row['time_added'],
'is_new' => !empty($row['is_new']) && !$user_info['is_guest'],
'views' => $row['views']
);
}
mysql_free_result($request);
echo '
<div class="smalltext" style="text-align: center; line-height: 1.4em; border: 1px #000000 solid; padding: 5px;">
<a href="',$galurl,'sa=viewitem;id=',$item['id'],'">',$item['item_title'],'</a><br />
<a href="',$galurl,'sa=viewitem;id=',$item['id'],'"><img alt="" src="',$galurl,'sa=getmedia;id=',$item['id_thumb'],'" alt="" /></a><br />
',$txt['mgallery_views'],' : ',$item['views'],'<br />
',$txt['mgallery_posted_by'],' : <a href="',$scripturl,'?action=profile;u=',$item['member_id'],'">',$item['member_name'],'</a><br />
',$txt['mgallery_in_album'],' : <a href="',$galurl,'sa=viewalbum;id=',$item['id_album'],'">',$item['album_name'],'</a>
',$item['is_new'] ? '<br /><img alt="" src="' . $settings['images_url'] . '/' . $context['user']['language'] . '/new.gif" border="0" />' : '','
</div>';
It will show a random item.
Note: I didn't had GD module on my local, so didn't test this if it works or not. Would be glad to hear some feedback.
-
Just letting you know that I have put the code in and it seems to be working just fine..thanks.
:)
-
Looks good to me.
-
When you are in the Media Gallery and you use the link for going back to the forum, you will end up in the portal.
I'm not good in php but I found out how to change it.
Search in Source/MGallery.php
// Start the linktree
$context['linktree'] = array();
$mgalFunc['add_linktree']($scripturl,$context['forum_name']);
$mgalFunc['add_linktree']($galurl2, $txt['mgallery_title'] );
Replace it with
// Start the linktree
$context['linktree'] = array(array('url' => $scripturl . '?action=forum', 'name' => 'Forum'));
$mgalFunc['add_linktree']($galurl2, $txt['mgallery_title'] );
After this change your link tree will be as it is in the whole forum. ;)
Test in SMF 1.1.7
SMF Media Gallery 1.5 RC 2
-
Hmmm. It's too bad that we need another edit for an external file. Thanks Manu.
-
Looks like its workin good but the thumbs are little red X's ? Any idea on how to fix that?
Thanks in advance
www.monsters-mansion.com
-
This feature is implemented.
-
It would be a nice option to allow filtering of the media. I'd like to show random photos, but half of my gallery is MP3's. I don't care to have those show up.
-
As far as I know only the photos do show.