SimplePortal

Development => Feature Requests => Applied Requests => Topic started by: Soms on September 17, 2008, 03:25:31 AM

Title: Media Gallery
Post 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!
Title: Re: Media Gallery
Post by: Nathaniel on September 17, 2008, 03:28:12 AM
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.
Title: Re: Media Gallery
Post by: cme1st2302 on September 18, 2008, 12:20:34 AM
 :wave: I too would be very interested in this block.   :wave:

BTW - thanks for creating such a great tool!!!
Title: Re: Media Gallery
Post by: sevacycles on September 18, 2008, 05:07:24 PM
I would like to see this aswell.

Title: Re: Media Gallery
Post by: [SiNaN] on September 18, 2008, 06:51:32 PM
Use this code with a php block, for now:

Code: [Select]
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.
Title: Re: Media Gallery
Post by: Jakki on September 18, 2008, 08:39:25 PM
Just letting you know that I have put the code in and it seems to be working just fine..thanks.
 :)
Title: Re: Media Gallery
Post by: sevacycles on September 19, 2008, 05:17:47 AM
Looks good to me.
Title: Re: Media Gallery
Post by: Manu on November 10, 2008, 06:36:38 PM
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
Code: [Select]
// Start the linktree
$context['linktree'] = array();
$mgalFunc['add_linktree']($scripturl,$context['forum_name']);
$mgalFunc['add_linktree']($galurl2, $txt['mgallery_title'] );

Replace it with
Code: [Select]
// 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
Title: Re: Media Gallery
Post by: [SiNaN] on November 11, 2008, 07:21:37 AM
Hmmm. It's too bad that we need another edit for an external file. Thanks Manu.
Title: Re: Media Gallery
Post by: mrtrc266 on November 25, 2008, 03:13:44 PM
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
Title: Re: Media Gallery
Post by: [SiNaN] on February 02, 2009, 06:21:22 AM
This feature is implemented.
Title: Re: Media Gallery
Post by: tfs on August 01, 2009, 05:28:02 PM
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.
Title: Re: Media Gallery
Post by: Old Fossil on September 07, 2009, 01:39:31 AM
As far as I know only the photos do show.

SimplePortal 2.3.8 © 2008-2024, SimplePortal