Facebook  Twitter 

SMFHacks.com

+- +-

SMFHacks.com

+- User Information

Welcome, Guest.
Please login or register.
 
 
 
Forgot your password?

+- Forum Stats

Members
Total Members: 12085
Latest: nguyenthoa1
New This Month: 7
New This Week: 1
New Today: 1
Stats
Total Posts: 38721
Total Topics: 6821
Most Online Today: 50
Most Online Ever: 2482
(April 09, 2011, 07:02:45 pm)
Users Online
Members: 0
Guests: 50
Total: 50

Author Topic: Random Image in Block?  (Read 120453 times)

0 Members and 1 Guest are viewing this topic.

Offline jklapp

  • Newbie
  • *
  • Posts: 45
    • View Profile
Random Image in Block?
« on: September 22, 2006, 06:40:03 pm »
Can a random image be put in a block with SMF Gallery ?

Offline SMFHacks

  • Administrator
  • Hero Member
  • *****
  • Posts: 14392
    • View Profile
Re: Random Image in Block?
« Reply #1 on: September 22, 2006, 06:48:38 pm »
You mean like a random image block for like tiny portal?
Just a box with a random image?
« Last Edit: September 22, 2006, 07:43:53 pm by SMFHacks »
Get your Forum Ranked! at https://www.forumrankings.net - find out how your forum compares with others! Also contests/promotions for verified sites.

Offline jklapp

  • Newbie
  • *
  • Posts: 45
    • View Profile
Re: Random Image in Block?
« Reply #2 on: September 22, 2006, 09:23:44 pm »
Yes :)

Offline SMFHacks

  • Administrator
  • Hero Member
  • *****
  • Posts: 14392
    • View Profile
Re: Random Image in Block?
« Reply #3 on: September 22, 2006, 09:30:06 pm »
Yeah that wouldn't hard to do I could supply some TP codes later on.
Get your Forum Ranked! at https://www.forumrankings.net - find out how your forum compares with others! Also contests/promotions for verified sites.

Offline jklapp

  • Newbie
  • *
  • Posts: 45
    • View Profile
Re: Random Image in Block?
« Reply #4 on: September 22, 2006, 10:06:32 pm »
Thank would be great!!!  Thank you :)

Offline BrocLee

  • Newbie
  • *
  • Posts: 5
    • View Profile
Re: Random Image in Block?
« Reply #5 on: September 29, 2006, 11:09:28 am »
Yeah, that would be a cool addition :)

Offline usermike3969

  • Newbie
  • *
  • Posts: 28
    • View Profile
    • mib4life
Re: Random Image in Block?
« Reply #6 on: October 03, 2006, 03:21:29 am »
i have a code that i use iin ssi.php that will show random imgs from what ever cat u wont  ;D

is it ok to put it here for everyone or is it something that u r doing for pro ver. only ???

Offline usermike3969

  • Newbie
  • *
  • Posts: 28
    • View Profile
    • mib4life
Re: Random Image in Block?
« Reply #7 on: October 03, 2006, 03:52:17 am »
heres a live demo www.mib4life.com:8080 on the left side 2nd block also with it being a ssi function u can use it even if your not using tportal

Offline SMFHacks

  • Administrator
  • Hero Member
  • *****
  • Posts: 14392
    • View Profile
Re: Random Image in Block?
« Reply #8 on: October 03, 2006, 06:35:49 pm »
Ah, I see it now the sig spotlight
Get your Forum Ranked! at https://www.forumrankings.net - find out how your forum compares with others! Also contests/promotions for verified sites.

Offline usermike3969

  • Newbie
  • *
  • Posts: 28
    • View Profile
    • mib4life
Re: Random Image in Block?
« Reply #9 on: October 03, 2006, 06:44:14 pm »
......so can i post the code here ?

Offline SMFHacks

  • Administrator
  • Hero Member
  • *****
  • Posts: 14392
    • View Profile
Re: Random Image in Block?
« Reply #10 on: October 03, 2006, 07:17:55 pm »
I don't mind.
Get your Forum Ranked! at https://www.forumrankings.net - find out how your forum compares with others! Also contests/promotions for verified sites.

Offline usermike3969

  • Newbie
  • *
  • Posts: 28
    • View Profile
    • mib4life
Re: Random Image in Block?
« Reply #11 on: October 03, 2006, 07:33:17 pm »
ok thanks....here it is

in ssi.php

Find :
Code: [Select]
?>
Place before :
Code: [Select]
function ssi_grandom ($cat)
{
mysql_select_db($db_name);
$query  = "SELECT `thumbfilename`,`ID_CAT`,`ID_PICTURE` FROM `smf_gallery_pic` WHERE `ID_CAT`='$cat' GROUP BY `thumbfilename` ORDER BY RAND() LIMIT 1";
$request = mysql_query($query);
while($row = mysql_fetch_array($request, MYSQL_ASSOC))
echo' <a href="' . $scripturl . '?action=gallery;sa=view;id=' . $row['ID_PICTURE'] . '"><img src="/gallery/'. $row['thumbfilename']  . '" />';}

then put in a php block   ssi_grandom(2);   where the 2 = cat number

Offline SMFHacks

  • Administrator
  • Hero Member
  • *****
  • Posts: 14392
    • View Profile
Re: Random Image in Block?
« Reply #12 on: October 03, 2006, 07:55:34 pm »
Nice work,

I updated it a little
Code: [Select]
function ssi_grandom ($cat)
{
global $scripturl,$db_prefix;
$cat = (int) $cat;

$request = db_query("SELECT thumbfilename, ID_CAT, ID_PICTURE FROM {$db_prefix}gallery_pic WHERE ID_CAT = $cat GROUP BY thumbfilename ORDER BY RAND() LIMIT 1", __FILE__, __LINE__);
$row = mysql_fetch_assoc($request);
mysql_free_result($request);
echo' <a href="', $scripturl, '?action=gallery;sa=view;id=', $row['ID_PICTURE'], '"><img src="/gallery/', $row['thumbfilename'] ,'" />'

;}
« Last Edit: October 03, 2006, 07:57:36 pm by SMFHacks »
Get your Forum Ranked! at https://www.forumrankings.net - find out how your forum compares with others! Also contests/promotions for verified sites.

Offline usermike3969

  • Newbie
  • *
  • Posts: 28
    • View Profile
    • mib4life
Re: Random Image in Block?
« Reply #13 on: October 03, 2006, 08:54:57 pm »
cool thanks

i am not very good with php i didnt even know any php like 6 mo. ago and that was the first little code that i did on my own

again thanks for fixing it

Offline usermike3969

  • Newbie
  • *
  • Posts: 28
    • View Profile
    • mib4life
Re: Random Image in Block?
« Reply #14 on: October 04, 2006, 07:07:05 am »
How about this ? It puts the linking codes below the thumb
Code: [Select]
function ssi_grandom ($cat)
{
    global $scripturl,$db_prefix;
    $cat = (int) $cat;

    $request = db_query("SELECT thumbfilename, filename, ID_CAT, ID_PICTURE FROM {$db_prefix}gallery_pic WHERE ID_CAT = $cat GROUP BY thumbfilename ORDER BY RAND() LIMIT 1", __FILE__, __LINE__);
    $row = mysql_fetch_assoc($request);
    mysql_free_result($request);
    echo' <a href="', $scripturl, '?action=gallery;sa=view;id=', $row['ID_PICTURE'], '"><img src="/gallery/', $row['thumbfilename'] ,'" /></a>';
 ?><script language="javascript" type="text/javascript">
<!--
function linkingcodes() {
  newwindow2=window.open('','name','height=350,width=800,scrollbars=yes');
  var tmp = newwindow2.document;
  tmp.write('<html><head><title>Linking codes</title>');
  tmp.write('');
  tmp.write('</head><body bgcolor="#000000"><center><font color="#FFFFFF">');
  tmp.write('HTML THUMB</br>&lt;img src="http://mib4life.com:8080/gallery/thumb_<?echo $row['filename'];?>"&gt; ');
  tmp.write('</br></br>HTML</br>&lt;img src="http://mib4life.com:8080/gallery/<?echo $row['filename']; ?>"&gt;');
  tmp.write('</br></br>BBC THUMB</br>[img]http://mib4life.com:8080/gallery/thumb_<?echo $row['filename'];?>[/img]');
  tmp.write('</br></br>BBC</br>[img]http://mib4life.com:8080/gallery/<?echo $row['filename']; ?>[/img]');
  tmp.write('</font></center></body></html>');
  tmp.close();
}
// -->
</script><center><form>
</br><input type="button" onClick="return linkingcodes()" value="Linking codes!">
</form></center>
<?
}



 

Related Topics

  Subject / Started by Replies Last post
4 Replies
2923 Views
Last post June 18, 2010, 09:18:00 am
by dvera
2 Replies
2670 Views
Last post October 15, 2010, 04:03:02 pm
by Rafferty
1 Replies
1688 Views
Last post October 16, 2016, 12:12:51 pm
by exit
5 Replies
2149 Views
Last post July 12, 2017, 03:45:34 pm
by donk
8 Replies
607 Views
Last post December 04, 2017, 09:41:20 pm
by Boomslanger

+- Recent Topics

SMF Store - Installed, but where is everything? by SMFHacks
April 22, 2018, 08:11:39 pm

Time offset by SMFHacks
April 21, 2018, 12:04:45 pm

Questions about by emilyturner
April 20, 2018, 04:34:17 am

Mass Change for Permissions by Dragon41673
April 17, 2018, 08:42:33 am

not previously loaded by loadMemberData.... by dan4ever
April 17, 2018, 01:53:00 am

Download title by SMFHacks
April 14, 2018, 06:57:02 pm

Responsive theme problems by SMFHacks
March 28, 2018, 12:40:58 pm

Image Scrolling by SMFHacks
March 26, 2018, 01:55:50 pm

error uninstalling contact page 3.2 by SMFHacks
March 26, 2018, 08:11:44 am

Search Tags by SMFHacks
March 25, 2018, 04:29:58 pm

Powered by EzPortal