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: 201
  • Total: 201

SMF Gallery Block

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

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

bluedevil

Sweet mod. It worked fine without complications. Changed the number of pics to display to 1. :up:

Thnx guys!                 BD.

bluedevil

Ok...now im getting more creative. I switched the limit to 4. Is it possibble to make it scroll from right to left?

houston

This mod seems to move all the contents of the block below it to the right, Has anybody else had this bug.

bluedevil

Quote from: houston on October 17, 2006, 04:33:33 AM
This mod seems to move all the contents of the block below it to the right, Has anybody else had this bug.

i had it on a right block with a limit of 1.It worked just fine.  Later changed to a center block with a limit of 4. No problems there either. Im guessing if you have a high limit it will leave the assigned area. But i may be wrong.

ScoobyDan

Hi,

Would it be possible to also add the title of the image, just below the image?

This script is great, and I think that having the title of the image (which could be turned off by commenting out the respective lines) would be the finishing touch.

Many thanks,

Daniel

HappyFace

A question for JPG, it is possible to cahnge it so that a random pic will be displayed?

ScoobyDan

#36
HappyFace,

I can answer that one :D

Change the line:
  $request = db_query("SELECT thumbfilename,ID_PICTURE FROM {$db_prefix}gallery_pic GROUP BY thumbfilename ORDER BY date DESC LIMIT 3", __FILE__,__LINE__);

to:
  $request = db_query("SELECT thumbfilename,ID_PICTURE FROM {$db_prefix}gallery_pic GROUP BY thumbfilename ORDER BY rand() DESC LIMIT 3", __FILE__,__LINE__);

i.e. change the "date" to "rand()".

You might also want to change the "LIMIT 3" to "LIMIT 1", to only show one picture.

Daniel

HappyFace

Quote from: ScoobyDan on October 28, 2006, 01:49:50 PM
HappyFace,

I can answer that one :D

Change the line:
  $request = db_query("SELECT thumbfilename,ID_PICTURE FROM {$db_prefix}gallery_pic GROUP BY thumbfilename ORDER BY date DESC LIMIT 3", __FILE__,__LINE__);

to:
  $request = db_query("SELECT thumbfilename,ID_PICTURE FROM {$db_prefix}gallery_pic GROUP BY thumbfilename ORDER BY rand() DESC LIMIT 3", __FILE__,__LINE__);

i.e. change the "date" to "rand()".

You might also want to change the "LIMIT 3" to "LIMIT 1", to only show one picture.

Daniel

Wow, thanks for the quick reply!

Do you also know how I can make the images appear below eachother?
Thanks.

D@ve

Quote from: houston on October 17, 2006, 04:33:33 AM
This mod seems to move all the contents of the block below it to the right, Has anybody else had this bug.

I also had that happen to me Houston. had to remove a 2 things. heres the code i used to fix
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 1", __FILE__,__LINE__);
  while ($row = mysql_fetch_assoc($request))
  echo' <td align="center" colspan="3"><a href="', $scripturl, '?action=gallery;sa=view;id=',
  $row['ID_PICTURE'], '"><img src="',  $modSettings['gallery_url'] .

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

TheWrks

It works for me  :up: Thanks to all that helped  ;D

Random Photo

http://www.michiganmini.org/forum/

This website is proudly hosted on Crocweb Cloud Website Hosting.