Hi,
does someone have a working Module for ProPortal to display a random ezGPro image?
Or knows a way to put a random image in an announcement?
I would like to present one (big) random image on entering the site.
Thanks!
Can you enter in php code?
Untested but maybe try
Code:
global $mybb, $db;
$groupsdata = $mybb->user['usergroup'];
$wherestats = "
LEFT JOIN ".TABLE_PREFIX."users AS m ON (m.uid = p.ID_MEMBER)
LEFT JOIN ".TABLE_PREFIX."usergroups AS mg ON (m.usergroup = mg.gid)
LEFT JOIN ".TABLE_PREFIX."gallery_usersettings AS s ON (s.ID_MEMBER = m.uid)
LEFT JOIN ".TABLE_PREFIX."gallery_log_mark_view AS v ON (p.ID_PICTURE = v.ID_PICTURE AND v.ID_MEMBER = " . $mybb->user['uid'] . " AND v.user_id_cat = p.USER_ID_CAT)
LEFT JOIN ".TABLE_PREFIX."gallery_catperm AS c ON (c.id_group IN ($groupsdata) AND c.id_cat = p.id_cat)
WHERE ((s.private =0 || s.private IS NULL ) AND (s.password = '' || s.password IS NULL ) AND p.USER_ID_CAT !=0 AND p.approved =1) || (p.approved = 1 AND p.user_id_cat = 0 AND (c.view IS NULL || c.view = 1)) ";
$result = $db->query("
SELECT
p.ID_PICTURE, p.commenttotal, p.totalratings, p.rating, p.filesize,
p.views, p.thumbfilename, p.title, p.ID_MEMBER, m.username, mg.namestyle,p.date,
p.description, p.mature, v.ID_PICTURE as unread
FROM ".TABLE_PREFIX."gallery_pic as p
$wherestats GROUP BY p.ID_PICTURE
ORDER BY RAND()
LIMIT 1"
);
$context['picture_list'] = array();
while($row = $db->fetch_array($result))
{
$context['picture_list'][] = $row;
}
$db->free_result($result);
foreach ($context['picture_list'] as $row)
{
echo '<a href="' . $mybb->settings['bburl'] . '/ezgallery.php?sa=view&id=', $row['ID_PICTURE'], '"><img src="', $mybb->settings['bburl'] . '/gallery/', $row['thumbfilename'], '" alt="" /></a><br />';
}
Cool - principally working ... now I only have to find a away to fill the width on the "container" the code snippet is in - so the full image resized no the thumb
Thanks!
Nice! You can add p.filename to the sql.
That use that variable instead on the display to show full size image.