SMFHacks.com
SMFHacks
Community Suite
SMF Gallery Pro
SMF Store
SMF Classifieds
Newsletter Pro
Downloads System Pro
Ad Seller Pro
Hacks and Mods
Latest SMF Hacks
TopTen Hacks
Styles and Themes
Add a Hack
Manage Hacks
Earn Money from Your Forum with these tips
SMF Theme Generator
SMF Package Parser
Free SMF Hosting
HostRocket Webhosting for SMF
Site Showcase
Search Forums
Advanced search
User
Welcome,
Guest
. Please
login
or
register
.
May 22, 2012, 01:23:36 pm
1 Hour
1 Day
1 Week
1 Month
Forever
Login with username, password and session length
Stats
Members
Total Members: 10066
Latest:
khoeidong
Stats
Total Posts: 28682
Total Topics: 4975
Online Today: 87
Online Ever: 2482
(April 09, 2011, 07:02:45 pm)
Users Online
Users: 1
Guests: 44
Total: 45
b-machinery
SMFHacks.com
Forum
SMF Gallery Lite
SMF Gallery Lite
Random Image in Block?
0 Members and 1 Guest are viewing this topic.
« previous
next »
Pages:
[
1
]
2
3
...
8
Author
Topic: Random Image in Block? (Read 73904 times)
jklapp
Newbie
Offline
Posts: 45
Random Image in Block?
«
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
Posts: 9676
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
»
Logged
jklapp
Newbie
Offline
Posts: 45
Re: Random Image in Block?
«
Reply #2 on:
September 22, 2006, 09:23:44 pm »
Yes
Logged
SMFHacks
Administrator
Hero Member
Offline
Posts: 9676
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.
Logged
jklapp
Newbie
Offline
Posts: 45
Re: Random Image in Block?
«
Reply #4 on:
September 22, 2006, 10:06:32 pm »
Thank would be great!!! Thank you
Logged
BrocLee
Newbie
Offline
Posts: 5
Re: Random Image in Block?
«
Reply #5 on:
September 29, 2006, 11:09:28 am »
Yeah, that would be a cool addition
Logged
usermike3969
Newbie
Offline
Posts: 28
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
is it ok to put it here for everyone or is it something that u r doing for pro ver. only
Logged
usermike3969
Newbie
Offline
Posts: 28
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
Logged
SMFHacks
Administrator
Hero Member
Offline
Posts: 9676
Re: Random Image in Block?
«
Reply #8 on:
October 03, 2006, 06:35:49 pm »
Ah, I see it now the sig spotlight
Logged
usermike3969
Newbie
Offline
Posts: 28
Re: Random Image in Block?
«
Reply #9 on:
October 03, 2006, 06:44:14 pm »
......so can i post the code here ?
Logged
SMFHacks
Administrator
Hero Member
Offline
Posts: 9676
Re: Random Image in Block?
«
Reply #10 on:
October 03, 2006, 07:17:55 pm »
I don't mind.
Logged
usermike3969
Newbie
Offline
Posts: 28
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:
?>
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
Posts: 9676
Re: Random Image in Block?
«
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
Newbie
Offline
Posts: 28
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
Logged
usermike3969
Newbie
Offline
Posts: 28
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:
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><img src="http://mib4life.com:8080/gallery/thumb_<?echo $row['filename'];?>"> ');
tmp.write('</br></br>HTML</br><img src="http://mib4life.com:8080/gallery/<?echo $row['filename']; ?>">');
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
« previous
next »
Jump to:
Please select a destination:
-----------------------------
SMFHacks.com
-----------------------------
=> News
=> Site Discussion
===> Suggestions
===> Bugs
-----------------------------
SMF Gallery Pro
-----------------------------
=> Announcements
=> Presales
=> Support
===> Bugs
===> Feature Requests
-----------------------------
SMF Store
-----------------------------
=> Announcements
=> Presales
=> Support
===> Guides and Tips
===> Feature Requests
===> Bugs
-----------------------------
SMF Classifieds
-----------------------------
=> Announcements
=> Presales
=> Support
===> Bugs
===> Feature Requests
-----------------------------
Downloads System Pro
-----------------------------
=> Announcements
=> Presales
=> Support
===> Feature Requests
===> Bugs
-----------------------------
Ad Seller Pro
-----------------------------
=> Presales
=> Support
-----------------------------
Newsletter Pro
-----------------------------
=> Presales
=> Support
===> Feature Requests
-----------------------------
Social Login Pro
-----------------------------
=> Presales
-----------------------------
Badge Awards
-----------------------------
=> Presales
-----------------------------
Tweet Topics/FB Post System
-----------------------------
=> Presales
-----------------------------
SMF Gallery Lite
-----------------------------
=> SMF Gallery Lite
-----------------------------
Modifications/Themes
-----------------------------
=> General SMF Forum
=> Modifications Talk
===> Latest Mods
===> Modification Showcase
=> Theme Talk
===> Theme Showcase
===> Latest Themes
Recent
Store IPN AMOUNT CHANGE
by
ApplianceJunk
[May 21, 2012, 08:54:11 am]
Transferring Db data from...
by
~ Phåråoh ~
[May 20, 2012, 11:06:52 am]
SMF vs PhpBB
by
channgam
[May 20, 2012, 05:58:11 am]
Any news?
by
SMFHacks
[May 19, 2012, 06:16:58 pm]
Social Login Pro domain c...
by
SMFHacks
[May 19, 2012, 05:42:37 pm]
licence information and q...
by
SMFHacks
[May 18, 2012, 03:08:38 pm]
no pictures after upgrade
by
SMFHacks
[May 17, 2012, 06:07:46 pm]
Viewers?
by
ApplianceJunk
[May 17, 2012, 02:22:07 pm]
Incorrect download counts...
by
SMFHacks
[May 17, 2012, 12:38:16 pm]
SMF V2.0.2 compatibility ...
by
~ Phåråoh ~
[May 15, 2012, 09:32:27 pm]
Random Picture
Donate to SMFHacks.com
Help Support the SMFHacks.com mod making.
Loading...