SMFHacks.com
SMFHacks
Community Suite
SMF Gallery Pro
SMF Store
SMF Classifieds
Newsletter Pro
Downloads System Pro
Ad Seller Pro
Badge Awards
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
Buy Website Traffic
Site Showcase
Email Marketing Software
Search Forums
Advanced search
User
Welcome,
Guest
. Please
login
or
register
.
May 19, 2013, 08:04:19 pm
1 Hour
1 Day
1 Week
1 Month
Forever
Login with username, password and session length
Stats
Members
Total Members: 10758
Latest:
murdocklawless
Stats
Total Posts: 32353
Total Topics: 5475
Online Today: 60
Online Ever: 2482
(April 09, 2011, 07:02:45 pm)
Users Online
Users: 2
Guests: 44
Total: 46
DTroup
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
...
3
4
[
5
]
6
7
8
Author
Topic: Random Image in Block? (Read 78795 times)
xface
Inline PM Customer
Offline
Posts: 16
Re: Random Image in Block?
«
Reply #60 on:
October 13, 2006, 10:13:11 am »
I changed up your output codes to this:
Code:
function ssi_galleryrandom()
{
global $scripturl,$db_prefix,$modSettings,$boardurl;
if(empty($modSettings['gallery_url']))
{
$modSettings['gallery_url'] = $boardurl . '/gallery/';
}
$request = db_query("SELECT thumbfilename,ID_PICTURE,filename FROM
{$db_prefix}gallery_pic GROUP BY thumbfilename ORDER BY RAND() LIMIT 1", __FILE__,
__LINE__);
$row = mysql_fetch_assoc($request);
mysql_free_result($request);
echo' <center><a href="', $scripturl, '?action=gallery;sa=view;id=',
$row['ID_PICTURE'], '"><img src="', $modSettings['gallery_url'] .
$row['thumbfilename'] ,'" /></a></center>'
;
?><script language="javascript" type="text/javascript">
<!--
function linkingcodes() {
newwindow2=window.open('','name','height=250,width=800,scrollbars=yes');
var tmp = newwindow2.document;
tmp.write('<html><head><title>Linking codes</title>');
tmp.write('');
tmp.write('</head><body bgcolor="#FFFFFF"><center><font color="#000000" size="1" face="verdana">');
tmp.write('HTML For Websites:</br><form><textarea rows="2" cols="90"><a href="<?echo $modSettings['gallery_url'].$row['filename']; ?>"><img src="<?echo $modSettings['gallery_url'].$row['thumbfilename'];?>"></a></textarea></form> ');
tmp.write('</br></br>BBC For Forums</br><form><textarea rows="2" cols="90">[url=<?echo $modSettings['gallery_url'].$row['filename']; ?>][img]<?echo $modSettings['gallery_url'].$row['thumbfilename'];?>[/img][/url]</textarea></form>');
tmp.write('</font></center></body></html>');
tmp.close();
}
// -->
</script><center><form>
</br><input type="button" onClick="return linkingcodes()" value="Linking codes!">
</form></center>
<?
}
and it works awesome as well.....
This way the code is easily selected and copied.
Logged
Jump1979man
Sr. Member
Offline
Posts: 274
Re: Random Image in Block?
«
Reply #61 on:
October 13, 2006, 11:07:34 am »
Quote from: Jpg on October 12, 2006, 06:58:15 pm
I'll help everyone out. I modified SMF Hack's code and made it center when it a block.. No biggy.
USE THIS ONE
Code:
function ssi_galleryrandom()
{
global $scripturl,$db_prefix,$modSettings,$boardurl;
if(empty($modSettings['gallery_url']))
{
$modSettings['gallery_url'] = $boardurl . '/gallery/';
}
$request = db_query("SELECT thumbfilename,ID_PICTURE FROM
{$db_prefix}gallery_pic GROUP BY thumbfilename ORDER BY RAND() LIMIT 1", __FILE__,
__LINE__);
$row = mysql_fetch_assoc($request);
mysql_free_result($request);
echo' <center><a href="', $scripturl, '?action=gallery;sa=view;id=',
$row['ID_PICTURE'], '"><img src="', $modSettings['gallery_url'] .
$row['thumbfilename'] ,'" /></a></center>'
;}
Put this in a
PHP
block.
Code:
ssi_galleryrandom();
Code works great! Thanks.
Logged
Midwest Motorcycles Forum
http://www.mwmotorcycles.com
Riverway Racing
https://www.riverwayracing.com
Motorcycle parts, gear, and accessories.
Jump1979man
Sr. Member
Offline
Posts: 274
Re: Random Image in Block?
«
Reply #62 on:
October 13, 2006, 11:08:11 am »
Anyway to have like the first 2 or three comments to show up as well???
Logged
Midwest Motorcycles Forum
http://www.mwmotorcycles.com
Riverway Racing
https://www.riverwayracing.com
Motorcycle parts, gear, and accessories.
Warbird
Inline PM Customer
Offline
Posts: 5
Re: Random Image in Block?
«
Reply #63 on:
October 30, 2006, 10:35:25 am »
I did what you guys did but still got a error in this box.
Quote
Parse error: parse error, unexpected $ in /var/www/vhosts/placenholder/subdomains/forums/httpdocs/Sources/Load.php(1718) : eval()'d code(35) : eval()'d code on line 1
What can it be ?
Logged
Warbird
Inline PM Customer
Offline
Posts: 5
Re: Random Image in Block?
«
Reply #64 on:
October 30, 2006, 10:40:55 am »
Hmm, ok, got it working now, donīt know why it didnīt worked before, but ok. One more question, is it possible to make a bigger thumbnail size ?
Its 104 x 78, but I would prefer the thumb more around 150 or 160 width, is that possible ?
WarBirD
Logged
SMFHacks
Administrator
Hero Member
Offline
Posts: 10988
Re: Random Image in Block?
«
Reply #65 on:
October 30, 2006, 10:48:09 am »
Well you could use html to enlarge the size of the image or if you really want a larger image you would need to change the thumbnail size in Gallery.php
Logged
Warbird
Inline PM Customer
Offline
Posts: 5
Re: Random Image in Block?
«
Reply #66 on:
October 30, 2006, 11:00:18 am »
Where in the text I put in SSI.PHP would be the place where to make it with HTML. Sry, i am not sure in code and all that.
Logged
Warbird
Inline PM Customer
Offline
Posts: 5
Re: Random Image in Block?
«
Reply #67 on:
October 30, 2006, 11:10:13 am »
Ok, since I donīt know where in the SSI.PHP Lines i added, i tried the GALLERY.PHP. There is quite sometimes the values 104 and 78 which I assume is the width and height. Changed them all, but still shows the same size as before. Anything else ?
WarbiRd
Logged
Warbird
Inline PM Customer
Offline
Posts: 5
Re: Random Image in Block?
«
Reply #68 on:
October 30, 2006, 11:15:49 am »
Ok, my Browserīs cache played badly on me. But here is the problem if I do it with the changes in GALLERY.PHP, it only creates Thumbs from now on with that Size. All the Images I had before in there are in the old Size. So I would like to have some help where to do the HTML resize values with
width=""
and
height=""
in the code I added to the SSI.PHP.
P.S:
How to get rid of the LINKING CODES button ?
«
Last Edit: October 30, 2006, 11:32:46 am by Warbird
»
Logged
Hack
Inline PM Customer
Offline
Posts: 1
Re: Random Image in Block?
«
Reply #69 on:
November 11, 2006, 11:02:19 am »
thought I would add my little bit of code to this block section too. All I have basically added is the Images name below each of the pictures thats shown in the block (also added a 'alt' tag for the image)
Code:
function ssi_galleryrandom()
{
global $scripturl,$db_prefix,$modSettings,$boardurl;
if(empty($modSettings['gallery_url']))
{
$modSettings['gallery_url'] = $boardurl . '/gallery/';
}
$request = db_query("SELECT thumbfilename, ID_PICTURE, title, description
FROM {$db_prefix}gallery_pic
WHERE ID_CAT NOT LIKE '%7%'
ORDER BY RAND() LIMIT 3", __FILE__, __LINE__);
while ($row = mysql_fetch_assoc($request))
{
echo' <center><a href="', $scripturl, '?action=gallery;sa=view;id=', $row['ID_PICTURE'], '"><img src="', $modSettings['gallery_url'] . $row['thumbfilename'] ,'" style="padding-bottom:3px; padding-top:6px" alt="Random Gallery Mini Image" /><br />' . $row['title'] . '<br /></a></center>';
}
mysql_free_result($request);
}
Got a feeling I have probably got the 'style' part of the image src thing incorrect, but I am only a beginner with this sort of thing. If you only want certain catagorys showing you will need to exclude them by changing the 'ID_CAT not like' part to exclude the catagory you dont want to be included (in my case it stops the news post images being included as part of the random image display).
Thanks for the block though, makes th site look snazzy. All I want to really add to this now is the ability to make it 'scroll' like you see with the phpnuke blocks.. does anyone know how to do this? (will save me some time if they do..)
Logged
Protocultura
Inline PM Customer
Offline
Posts: 7
Re: Random Image in Block?
«
Reply #70 on:
November 20, 2006, 09:30:59 am »
Hi, I'm receiving the same error reported a few lines ago.
Code:
Fatal error: Call to undefined function: ssi_galleryrandom() in /home/c4dbra/public_html/Sources/Load.php(1708) : eval()'d code on line 427
Somebody knows why?
Thanks.
Logged
SMFHacks
Administrator
Hero Member
Offline
Posts: 10988
Re: Random Image in Block?
«
Reply #71 on:
November 20, 2006, 09:45:10 am »
Do you have the ssi_galleryrandom() in SSI.php and are you using an SSI block?
Logged
Protocultura
Inline PM Customer
Offline
Posts: 7
Re: Random Image in Block?
«
Reply #72 on:
November 20, 2006, 10:02:33 am »
Yep.
SSI.php
Code:
function ssi_galleryrandom()
{
global $scripturl,$db_prefix,$modSettings,$boardurl;
if(empty($modSettings['gallery_url']))
{
$modSettings['gallery_url'] = $boardurl . '/gallery/';
}
$request = db_query("SELECT thumbfilename,ID_PICTURE,filename FROM
{$db_prefix}gallery_pic GROUP BY thumbfilename ORDER BY RAND() LIMIT 1", __FILE__,
__LINE__);
$row = mysql_fetch_assoc($request);
mysql_free_result($request);
echo' <center><a href="', $scripturl, '?action=gallery;sa=view;id=',
$row['ID_PICTURE'], '"><img src="', $modSettings['gallery_url'] .
$row['thumbfilename'] ,'" /></a></center>'
;
?><script language="javascript" type="text/javascript">
<!--
function linkingcodes() {
newwindow2=window.open('','name','height=250,width=800,scrollbars=yes');
var tmp = newwindow2.document;
tmp.write('<html><head><title>Linking codes</title>');
tmp.write('');
tmp.write('</head><body bgcolor="#FFFFFF"><center><font color="#000000" size="1" face="verdana">');
tmp.write('HTML For Websites:</br><form><textarea rows="2" cols="90"><a href="<?echo $modSettings['gallery_url'].$row['filename']; ?>"><img src="<?echo $modSettings['gallery_url'].$row['thumbfilename'];?>"></a></textarea></form> ');
tmp.write('</br></br>BBC For Forums</br><form><textarea rows="2" cols="90">[url=<?echo $modSettings['gallery_url'].$row['filename']; ?>][img]<?echo $modSettings['gallery_url'].$row['thumbfilename'];?>[/img][/url]</textarea></form>');
tmp.write('</font></center></body></html>');
tmp.close();
}
// -->
</script><center><form>
</br><input type="button" onClick="return linkingcodes()" value="Linking codes!">
</form></center>
<?
}
?>
index.template.php
Code:
<table width="860" border="0" cellpadding="0" cellspacing="0">
<tr>
<td>';
ssi_galleryrandom();
echo '</td>
</tr>
<tr>...
Any idea?
Thanks
Logged
SMFHacks
Administrator
Hero Member
Offline
Posts: 10988
Re: Random Image in Block?
«
Reply #73 on:
November 20, 2006, 10:12:09 am »
oh that code won't work since SSI requires that it be loaded before all php
You would need to replace ssi_galleryrandom(); in your index.template.ph with something like
Code:
global $scripturl,$db_prefix,$modSettings,$boardurl;
if(empty($modSettings['gallery_url']))
{
$modSettings['gallery_url'] = $boardurl . '/gallery/';
}
$request = db_query("SELECT thumbfilename,ID_PICTURE,filename FROM
{$db_prefix}gallery_pic GROUP BY thumbfilename ORDER BY RAND() LIMIT 1", __FILE__,
__LINE__);
$row = mysql_fetch_assoc($request);
mysql_free_result($request);
echo' <center><a href="', $scripturl, '?action=gallery;sa=view;id=',
$row['ID_PICTURE'], '"><img src="', $modSettings['gallery_url'] .
$row['thumbfilename'] ,'" /></a></center>'
;
?><script language="javascript" type="text/javascript">
<!--
function linkingcodes() {
newwindow2=window.open('','name','height=250,width=800,scrollbars=yes');
var tmp = newwindow2.document;
tmp.write('<html><head><title>Linking codes</title>');
tmp.write('');
tmp.write('</head><body bgcolor="#FFFFFF"><center><font color="#000000" size="1" face="verdana">');
tmp.write('HTML For Websites:</br><form><textarea rows="2" cols="90"><a href="<?echo $modSettings['gallery_url'].$row['filename']; ?>"><img src="<?echo $modSettings['gallery_url'].$row['thumbfilename'];?>"></a></textarea></form> ');
tmp.write('</br></br>BBC For Forums</br><form><textarea rows="2" cols="90">[url=<?echo $modSettings['gallery_url'].$row['filename']; ?>][img]<?echo $modSettings['gallery_url'].$row['thumbfilename'];?>[/img][/url]</textarea></form>');
tmp.write('</font></center></body></html>');
tmp.close();
}
// -->
</script><center><form>
</br><input type="button" onClick="return linkingcodes()" value="Linking codes!">
</form></center>
<?
Logged
Protocultura
Inline PM Customer
Offline
Posts: 7
Re: Random Image in Block?
«
Reply #74 on:
November 20, 2006, 10:59:16 am »
thanks, works like a charm!
You can see the mod in my site
www.c4dbrasil.com
Thanks SMFHacks a priceless piece of code!!!
Logged
Pages:
1
...
3
4
[
5
]
6
7
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
-----------------------------
Menu Editor Pro
-----------------------------
=> Presales Menu Editor Pro
=> Bug Reports
-----------------------------
Inline Personal Messages
-----------------------------
=> Presales
=> Support
=> Bug Reports
-----------------------------
Newsletter Pro
-----------------------------
=> Presales
=> Support
===> Feature Requests
-----------------------------
Badge Awards
-----------------------------
=> Presales
=> Support
-----------------------------
Tweet Topics/FB Post System
-----------------------------
=> Presales
-----------------------------
Social Login Pro
-----------------------------
=> 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
Upgrade SMF Gallery Pro
by
DTroup
[
Today
at 07:16:11 pm]
sa facebook integration c...
by
murdocklawless
[
Today
at 07:03:27 am]
Feature Requests for SMF ...
by
Secure
[May 16, 2013, 10:13:46 pm]
stuck on "Processing" scr...
by
SMFHacks
[May 15, 2013, 11:32:14 pm]
[Request] - Award for any...
by
SMFHacks
[May 15, 2013, 11:31:24 pm]
SMF Gallery Pro 5.0.1 not...
by
SMFHacks
[May 12, 2013, 09:10:43 am]
Golf Theme
by
Serglike
[May 10, 2013, 03:49:55 am]
Display ads on every page...
by
SMFHacks
[May 07, 2013, 07:12:40 pm]
Edited simple ad code and...
by
ApplianceJunk
[May 07, 2013, 02:37:14 pm]
"non" error on bulk uploa...
by
SMFHacks
[May 06, 2013, 10:29:56 pm]
Random Picture
Donate to SMFHacks.com
Help Support the SMFHacks.com mod making.
Loading...