TP-Docs
HTML5 Icon HTML5 Icon HTML5 Icon
TP on Social Media

Recent

Welcome to TinyPortal. Please login or sign up.

Members
  • Total Members: 3,966
  • Latest: safir45
Stats
  • Total Posts: 195,994
  • Total Topics: 21,325
  • Online today: 291
  • Online ever: 8,223 (February 19, 2025, 04:35:35 AM)
Users Online
  • Users: 0
  • Guests: 145
  • Total: 145

SMF Gallery Block

Started by HaxXxoR, September 19, 2006, 06:50:04 PM

Previous topic - Next topic

0 Members and 2 Guests are viewing this topic.

Thurnok

#40
If you are looking for a random pic, latest, oldest, most/least viewed, most/least commented, pics from members on your buddy list, or pics from a specific member in their profile block then  try this block.
Thurnok
The one, the only!

Slack

#41
Hahaha old thread but sweet snippet.

http://exposingmusic.net/index.php?action=gallery

kopijun

QuoteWait...lol...hahahaha..I forgot something in my code....

global $scripturl,$db_prefix,$modSettings,$boardurl;
  echo'<table cellspacing="0" cellpadding="5" border="0" align="center" width="90%"><tr>';
  if(empty($modSettings['gallery_url']))
  {
    $modSettings['gallery_url'] = $boardurl . '/gallery/';
  }
  $request = db_query("SELECT thumbfilename,ID_PICTURE FROM {$db_prefix}gallery_pic GROUP BY thumbfilename ORDER BY date DESC LIMIT 3", __FILE__,__LINE__);
  while ($row = mysql_fetch_assoc($request))
  echo' <center><td align="center" colspan="3"><a href="', $scripturl, '?action=gallery;sa=view;id=',
  $row['ID_PICTURE'], '"><img src="',  $modSettings['gallery_url'] .

  $row['thumbfilename'] ,'" /></a></center>';
  echo'</td></tr>';
  echo'</table></br>';
  mysql_free_result($request);

It's very nice, I just used in my sites...But Is it possible to make this block showed only on the 1st page ? I mean, when I look article category, this gallery block is always there....Could anyone tell me what to do ? Thanks in advance..

Freddy

#43
Here's a slight modifcation that will scroll any number of random images from SMF gallery and also generate roll over texts for each image.

Alter scrollamount and scrolldelay to change the scrolling speed.

You might want to alter the marquee width to fit wherever you are using it.

Change the RAND() LIMIT value to alter the number of images it displays, or tailor that bit to suit your needs.

global $scripturl, $db_prefix, $modSettings, $boardurl;

echo '<div align="center"><marquee scrollamount="1" scrolldelay="20" direction="left" loop="true" width="50%" onmouseover=\'this.stop()\'onmouseout=\'this.start()\'>';

if(empty($modSettings['gallery_url']))
{
     $modSettings['gallery_url'] = $boardurl . '/gallery/';
}

$request = db_query("SELECT thumbfilename, ID_PICTURE, title, ID_MEMBER FROM {$db_prefix}gallery_pic GROUP BY thumbfilename ORDER BY RAND() LIMIT 20" , __FILE__,__LINE__);

while ($row = mysql_fetch_assoc($request))
{
     $request_name = db_query("SELECT memberName FROM {$db_prefix}members WHERE ID_MEMBER LIKE '{$row['ID_MEMBER']}'", __FILE__, __LINE__);
     $row_name = mysql_fetch_assoc($request_name);

     $alt_text = $row['title'] . " by " . $row_name['memberName'];

     echo ' <a href="', $scripturl, '?action=gallery;sa=view;id=', $row['ID_PICTURE'], '"><img alt="' , $alt_text , '" src="',  $modSettings['gallery_url'] . $row['thumbfilename'] ,'" /></a>';

     mysql_free_result($request_name);
}
     
echo '</marquee></div>';

mysql_free_result($request);


Here's how I am using it : http://aidreams.co.uk/forum/index.php?action=gallery

forummaker

Finally found a code that works without any errors. Thanks!

NenaGb

I second this ...although this thread is outdated THANK YOU SO MUCH FOR THE CODE and the fixes

This website is proudly hosted on Crocweb Cloud Website Hosting.