Facebook  Twitter 

SMFHacks.com

+- +-

SMFHacks.com

+- User Information

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

+- Forum Stats

Members
Total Members: 12411
Latest: PabloWatts
New This Month: 1
New This Week: 0
New Today: 0
Stats
Total Posts: 39948
Total Topics: 7033
Most Online Today: 60
Most Online Ever: 2482
(April 09, 2011, 07:02:45 pm)
Users Online
Members: 0
Guests: 47
Total: 47

Author Topic: Random Image in Block?  (Read 124998 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: 14978
    • 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!

Like What I do? Support me at https://www.patreon.com/vbgamer45/

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: 14978
    • 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!

Like What I do? Support me at https://www.patreon.com/vbgamer45/

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: 14978
    • 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!

Like What I do? Support me at https://www.patreon.com/vbgamer45/

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: 14978
    • 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!

Like What I do? Support me at https://www.patreon.com/vbgamer45/

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: 14978
    • 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!

Like What I do? Support me at https://www.patreon.com/vbgamer45/

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
3359 Views
Last post June 18, 2010, 09:18:00 am
by dvera
2 Replies
3441 Views
Last post October 15, 2010, 04:03:02 pm
by Rafferty
1 Replies
2387 Views
Last post October 16, 2016, 12:12:51 pm
by exit
5 Replies
2731 Views
Last post July 12, 2017, 03:45:34 pm
by donk
8 Replies
3792 Views
Last post December 04, 2017, 09:41:20 pm
by Boomslanger

+- Recent Topics

hashTags only used by admins, but visible to everyone? by SMFHacks
December 04, 2019, 11:08:35 am

Responsive Layout by Matthias
November 30, 2019, 03:05:57 pm

Secure connection failed Pretty Url Pro by Rock Lee
November 26, 2019, 10:44:23 am

Black Friday Sale Week 2019 by SMFHacks
November 23, 2019, 04:47:56 pm

German Translation missing in SMF 2.1R1 by SMFHacks
November 19, 2019, 02:38:42 pm

Unread items issue by SMFHacks
November 19, 2019, 10:07:32 am

Update detect mobile mode PHP5 to PHP7 by Rock Lee
November 16, 2019, 07:18:13 pm

PHP error by davejo
November 12, 2019, 12:09:47 pm

Message Editor Pro Issues by SMFHacks
November 06, 2019, 09:58:33 pm

most popular categories doesnt work by fussilet
November 02, 2019, 02:51:42 pm

Powered by EzPortal