Facebook  Twitter 

SMFHacks.com

+-

SMFHacks.com

+- User Information

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

+- Forum Stats

Members
Total Members: 4253
Latest: Ineedsmfhelp
New This Month: 1
New This Week: 0
New Today: 0
Stats
Total Posts: 43242
Total Topics: 7516
Most Online Today: 92
Most Online Ever: 2482
(April 09, 2011, 07:02:45 pm)
Users Online
Members: 0
Guests: 93
Total: 93

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

0 Members and 1 Guest are viewing this topic.

Offline jklapp

  • Member
  • *
  • 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: 16428
    • 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

  • Member
  • *
  • 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: 16428
    • 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

  • Member
  • *
  • 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

  • Member
  • *
  • 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

  • Member
  • *
  • 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

  • Member
  • *
  • 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: 16428
    • 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

  • Member
  • *
  • 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: 16428
    • 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

  • Member
  • *
  • 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: 16428
    • 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

  • Member
  • *
  • 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

  • Member
  • *
  • 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
6051 Views
Last post June 18, 2010, 09:18:00 am
by dvera
2 Replies
9255 Views
Last post October 15, 2010, 04:03:02 pm
by Rafferty
1 Replies
5370 Views
Last post October 16, 2016, 12:12:51 pm
by exit
5 Replies
5315 Views
Last post July 12, 2017, 03:45:34 pm
by donk
8 Replies
6975 Views
Last post December 04, 2017, 09:41:20 pm
by Boomslanger

+- Recent Topics

is it possible to add support for odysee.com by SMFHacks
March 13, 2024, 10:53:28 pm

Request for admin notification by davejo
March 10, 2024, 01:31:59 am

I need help with torrent upload by Ineedsmfhelp
March 09, 2024, 10:01:13 pm

an idea for new mod (( content type with different display )) by SMFHacks
February 27, 2024, 01:36:27 pm

[Mod] RSS Feed Poster by SMFHacks
February 27, 2024, 11:57:18 am

find duplicate pictures by fvlog19
February 14, 2024, 02:22:40 pm

Error uploading video. by SMFHacks
February 08, 2024, 02:04:16 pm

Gallery icon as last added image by fvlog19
February 01, 2024, 01:04:56 pm

User Gallery Feature: move / bulk move images by SMFHacks
January 30, 2024, 05:48:25 pm

In the future it may be for smf 2.1.x? by smithloo
January 30, 2024, 12:55:34 am

Powered by EzPortal