Development > Applied Requests

Media Gallery

(1/3) > >>

Soms:
Is it possible to add a feature to be able to display random pictures using the photos in the (new) SMF Media Gallery instead of the (old) SMF Gallery? Or at least give the choice of choosing between the two or using both?

Keep up the good work!

Nathaniel:
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.

cme1st2302:
 :wave: I too would be very interested in this block.   :wave:

BTW - thanks for creating such a great tool!!!

sevacycles:
I would like to see this aswell.

[SiNaN]:
Use this code with a php block, for now:


--- Code: --- 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>';
--- End code ---

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.

Navigation

[0] Message Index

[#] Next page

Go to full version