Twitter SMFHacks Facebook SMFHacks SMFHacks.com
** Home Forum Index Hacks Products Login Register Search
Welcome, Guest. Please login or register.
May 25, 2013, 09:31:48 am

Login with username, password and session length
Members
Total Members: 10769
Latest: johnnyv_nl
Stats
Total Posts: 32410
Total Topics: 5483
Online Today: 58
Online Ever: 2482
(April 09, 2011, 07:02:45 pm)
Users Online
Users: 3
Guests: 41
Total: 44
+ 
|-+ 
| |-+ 
| | |-+ 
| | | |-+ 
0 Members and 1 Guest are viewing this topic. « previous next »
Pages: [1] 2 3 ... 8 Go Down Print
Author Topic: Random Image in Block?  (Read 78862 times)
jklapp
Inline PM Customer
*****
Offline Offline

Posts: 45


View Profile
« on: September 22, 2006, 06:40:03 pm »

Can a random image be put in a block with SMF Gallery ?
Logged
SMFHacks
Administrator
Hero Member
*****
Offline Offline

Posts: 11009


View Profile
« 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 » Logged
jklapp
Inline PM Customer
*****
Offline Offline

Posts: 45


View Profile
« Reply #2 on: September 22, 2006, 09:23:44 pm »

Yes Smiley
Logged
SMFHacks
Administrator
Hero Member
*****
Offline Offline

Posts: 11009


View Profile
« 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.
Logged
jklapp
Inline PM Customer
*****
Offline Offline

Posts: 45


View Profile
« Reply #4 on: September 22, 2006, 10:06:32 pm »

Thank would be great!!!  Thank you Smiley
Logged
BrocLee
Inline PM Customer
*****
Offline Offline

Posts: 5


View Profile
« Reply #5 on: September 29, 2006, 11:09:28 am »

Yeah, that would be a cool addition Smiley
Logged
usermike3969
Inline PM Customer
*****
Offline Offline

Posts: 28


View Profile WWW
« 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  Grin

is it ok to put it here for everyone or is it something that u r doing for pro ver. only Huh
Logged
usermike3969
Inline PM Customer
*****
Offline Offline

Posts: 28


View Profile WWW
« 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
Logged
SMFHacks
Administrator
Hero Member
*****
Offline Offline

Posts: 11009


View Profile
« Reply #8 on: October 03, 2006, 06:35:49 pm »

Ah, I see it now the sig spotlight
Logged
usermike3969
Inline PM Customer
*****
Offline Offline

Posts: 28


View Profile WWW
« Reply #9 on: October 03, 2006, 06:44:14 pm »

......so can i post the code here ?
Logged
SMFHacks
Administrator
Hero Member
*****
Offline Offline

Posts: 11009


View Profile
« Reply #10 on: October 03, 2006, 07:17:55 pm »

I don't mind.
Logged
usermike3969
Inline PM Customer
*****
Offline Offline

Posts: 28


View Profile WWW
« Reply #11 on: October 03, 2006, 07:33:17 pm »

ok thanks....here it is

in ssi.php

Find :
Code:
?>

Place before :
Code:
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
Logged
SMFHacks
Administrator
Hero Member
*****
Offline Offline

Posts: 11009


View Profile
« Reply #12 on: October 03, 2006, 07:55:34 pm »

Nice work,

I updated it a little
Code:
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 » Logged
usermike3969
Inline PM Customer
*****
Offline Offline

Posts: 28


View Profile WWW
« 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
Logged
usermike3969
Inline PM Customer
*****
Offline Offline

Posts: 28


View Profile WWW
« Reply #14 on: October 04, 2006, 07:07:05 am »

How about this ? It puts the linking codes below the thumb
Code:
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>
<?
}


Logged
Pages: [1] 2 3 ... 8 Go Up Print 
« previous next »
Jump to:  

Recent
[Today at 09:25:21 am]

[May 24, 2013, 06:36:59 pm]

[May 24, 2013, 05:22:09 pm]

[May 24, 2013, 05:20:20 pm]

[May 24, 2013, 05:11:52 pm]

[May 23, 2013, 08:29:56 pm]

[May 23, 2013, 04:50:21 am]

[May 22, 2013, 10:03:30 pm]

[May 22, 2013, 03:00:09 pm]

[May 22, 2013, 03:03:31 am]
Random Picture
Donate to SMFHacks.com
Help Support the SMFHacks.com mod making.
Powered by SMF 1.1.18 | SMF © 2013, Simple Machines
TinyPortal v0.9.7 © Bloc
SMF and SimpleMachines are registered trademarks of Simple Machines. SMFHacks.com is not affiliated with nor endorsed by Simple Machines.
Page created in 1.181 seconds with 22 queries.