Previous Thread
Next Thread
Print Thread
Hop To
Random image island #260118 05/02/2017 8:39 AM
Joined: Jun 2006
Posts: 679
Morgan Offline OP
Addict
OP Offline
Addict
Joined: Jun 2006
Posts: 679
Hi,

I'm trying to lure our members to visit our Gallery forum more.
Tried to put latest gallery image in the left column however the same photo
is there to long as there is not so many new posts.

I see there is a Randome image Island here on UBBCentral but there is no such Island
in the portal layout, at least I have not seen anyone.

Is there a way/place to pick up the code for the Randome image Island?

Cheers


Morgan Johansson
BritBike Forum
http://www.britbike.com/forums/ubbthreads.php
Re: Random image island [Re: Morgan] #260119 05/02/2017 1:23 PM
Joined: Jun 2006
Posts: 15,843
Gizmo Online Tapedshut
UBB.threads Developer
Online Tapedshut
UBB.threads Developer
Joined: Jun 2006
Posts: 15,843
Random Image is a Custom Island that someone built; the contents are as follows:
Code
/* PHP CODE HERE */
$query = "
	SELECT
		`POST_ID`, `FILE_DIR`, `FILE_NAME`
	FROM
		`{$config['TABLE_PREFIX']}FILES`
	WHERE
		`FILE_DIR`<>''
	ORDER BY
		rand()
	LIMIT
		1
";
$sth = $dbh->do_query($query,__LINE__,__FILE__);
list($postId,$fDir,$fName) = $dbh->fetch_array($sth);

/* BODY HERE */
$body = <<<EOF
<div style="text-align: center;">
<a href="{$config['BASE_URL']}/ubbthreads.php?ubb=showgallery&Number=$postId">
<img src="{$config['BASE_URL']}/gallery/$fDir/thumbs/$fName" alt="" title="">
</a>
</div>
EOF;


Note that this code isn't very elegant, and is completely unsupported as it is not my code; your mileage may vary.

Last edited by Gizmo; 05/04/2017 3:30 PM. Reason: Cleaned database query

I am a Web Development Contractor, I do not work for UBBCentral. I have provided free User to User Support since the beginning of these support forums.
Need to Upgrade?
Forums: A Gardeners Forum Scouters World
UBB.threads: UBBWiki, UBB Styles, UBB.Sitemaps
Longtime Supporter & Resident Post-A-Holic
VNC Web Services: Code Modifications, Upgrades, Styling, Coding Services, Disaster Recovery, and more!
Re: Random image island [Re: Morgan] #260122 05/02/2017 3:29 PM
Joined: Jun 2006
Posts: 679
Morgan Offline OP
Addict
OP Offline
Addict
Joined: Jun 2006
Posts: 679
Gizmo I tried and did not get it to work,

First, my Table prefix is ubbt_bbf as you see I added "bbf" when I created the database.
Do I need to alter your code and insert the "bbf"?

second, I used all your code and emptied the box before I pasted in all code but got an error
what can I do wrong?



Last edited by Morgan; 05/02/2017 3:32 PM.

Morgan Johansson
BritBike Forum
http://www.britbike.com/forums/ubbthreads.php
Re: Random image island [Re: Morgan] #260124 05/02/2017 3:32 PM
Joined: Jun 2006
Posts: 15,843
Gizmo Online Tapedshut
UBB.threads Developer
Online Tapedshut
UBB.threads Developer
Joined: Jun 2006
Posts: 15,843
ubbt_FILES should be changed to whatever your database prefix is (IE: bbf_FILES); again this is not my code, support is unavailable.


I am a Web Development Contractor, I do not work for UBBCentral. I have provided free User to User Support since the beginning of these support forums.
Need to Upgrade?
Forums: A Gardeners Forum Scouters World
UBB.threads: UBBWiki, UBB Styles, UBB.Sitemaps
Longtime Supporter & Resident Post-A-Holic
VNC Web Services: Code Modifications, Upgrades, Styling, Coding Services, Disaster Recovery, and more!
Re: Random image island [Re: Morgan] #260125 05/02/2017 3:36 PM
Joined: Jun 2006
Posts: 679
Morgan Offline OP
Addict
OP Offline
Addict
Joined: Jun 2006
Posts: 679
ok the word ubbt_FILES maybe needs to be ubbt_bbfFILES or maybe ubbt_bbf
I maybe should stay out of it..


Morgan Johansson
BritBike Forum
http://www.britbike.com/forums/ubbthreads.php
Re: Random image island [Re: Morgan] #260126 05/02/2017 3:39 PM
Joined: Jun 2006
Posts: 15,843
Gizmo Online Tapedshut
UBB.threads Developer
Online Tapedshut
UBB.threads Developer
Joined: Jun 2006
Posts: 15,843
The default database prefix is "ubbt_" and generally does not need to be changed, unless you're running multiple copies of UBB.threads.

In the code the database table is "ubbt_FILES", db prefix "ubbt_", so if your prefix in your config is "morgan_" the table would be: "morgan_FILES", likewise "morgan" would be "morganFILES".

The easiest thing to do would be to load PHPMyAdmin and look for the FILES table and use that.


I am a Web Development Contractor, I do not work for UBBCentral. I have provided free User to User Support since the beginning of these support forums.
Need to Upgrade?
Forums: A Gardeners Forum Scouters World
UBB.threads: UBBWiki, UBB Styles, UBB.Sitemaps
Longtime Supporter & Resident Post-A-Holic
VNC Web Services: Code Modifications, Upgrades, Styling, Coding Services, Disaster Recovery, and more!
Re: Random image island [Re: Morgan] #260127 05/02/2017 3:42 PM
Joined: Jun 2006
Posts: 679
Morgan Offline OP
Addict
OP Offline
Addict
Joined: Jun 2006
Posts: 679
ok my prefix is ubbt_bbf so I should use ubbt_bbfFILES
I will try that once


Morgan Johansson
BritBike Forum
http://www.britbike.com/forums/ubbthreads.php
Re: Random image island [Re: Morgan] #260128 05/02/2017 3:47 PM
Joined: Apr 2004
Posts: 1,517
isaac Offline
UBB.threads Developer
Offline
UBB.threads Developer
Joined: Apr 2004
Posts: 1,517
Adjust the code as needed. Gizmo only shared it here for reference or as an example for building your own.

If its not part of the code that was downloaded from the Member Area in the forum software archive, it should be received as "Unsupported Custom Code."


Current developer of UBB.threads PHP Forum Software // 7.7.3 released!
isaac @ id242.com // my forum @ CelicaHobby.com
Re: Random image island [Re: Morgan] #260129 05/02/2017 3:58 PM
Joined: Jun 2006
Posts: 679
Morgan Offline OP
Addict
OP Offline
Addict
Joined: Jun 2006
Posts: 679
I got it to work but after reading Isaac comment and Gizmos off course
I decided to delete it and not use it. Don't like it is an "Unsupported Custom Code." ..
Somehow I like to play by the UBBThreads official book.
Still It's a bit strange to see the "unsupported" Random image island on the official UBBthreads forum wink


Morgan Johansson
BritBike Forum
http://www.britbike.com/forums/ubbthreads.php
Re: Random image island [Re: Morgan] #260130 05/02/2017 3:59 PM
Joined: Jun 2006
Posts: 15,843
Gizmo Online Tapedshut
UBB.threads Developer
Online Tapedshut
UBB.threads Developer
Joined: Jun 2006
Posts: 15,843
Not really, it's showing that you can expand the product by use of custom islands.


I am a Web Development Contractor, I do not work for UBBCentral. I have provided free User to User Support since the beginning of these support forums.
Need to Upgrade?
Forums: A Gardeners Forum Scouters World
UBB.threads: UBBWiki, UBB Styles, UBB.Sitemaps
Longtime Supporter & Resident Post-A-Holic
VNC Web Services: Code Modifications, Upgrades, Styling, Coding Services, Disaster Recovery, and more!
Re: Random image island [Re: Morgan] #260133 05/02/2017 4:22 PM
Joined: Jun 2006
Posts: 679
Morgan Offline OP
Addict
OP Offline
Addict
Joined: Jun 2006
Posts: 679
I get it Gizmo, Custom islands I understand and know how they work as long as its html and easy stuff inserted but when it comes to database queries etc then I don't know what the details means so I better stay out of those as it may cause faults and I really can't afford to cause it and not being able to get support.

Hope you understand sometimes its difficult to explain in English.. smile
Maybe there will be a random image option in 8.0 grin

I need to find another tactic to lure our members to use the gallery forum more.

Thanks again I like to discuss forum things one learns.. smile


Morgan Johansson
BritBike Forum
http://www.britbike.com/forums/ubbthreads.php
Re: Random image island [Re: Morgan] #260134 05/02/2017 4:26 PM
Joined: Apr 2004
Posts: 1,517
isaac Offline
UBB.threads Developer
Offline
UBB.threads Developer
Joined: Apr 2004
Posts: 1,517
Morgan, its called a "Custom Portal Island" so that you can customize it. They are not officially supported, just as any Style customizations you may make. The options are there for you to change the presentation of your forums to your own liking.

I'd buy you a coffee and we could catch up on your british bikes, and all the cool things you've seen people do with them. I'd really enjoy that a lot!
But there are two things standing in my way, that "pond" (small ocean between europe and north america) and the fact that I'd have to change my schedule to make it all happen. I could make it work, but I need to change a few things to begin making it a reality laugh

Cheers


Current developer of UBB.threads PHP Forum Software // 7.7.3 released!
isaac @ id242.com // my forum @ CelicaHobby.com
Re: Random image island [Re: Morgan] #260135 05/02/2017 4:43 PM
Joined: Jun 2006
Posts: 679
Morgan Offline OP
Addict
OP Offline
Addict
Joined: Jun 2006
Posts: 679
Isaac, the pond is no big deal at all, It's like flying to your eastcoast just that they go north over the pole and you land here a few hours later and I'm 20min from the airport, you get to chose from 4 different bikes from 1955-70. Free beer included or coffe for that matter.. wink
Remember rear brake pedal is on the left side on those bikes and gear shift on the right side..
I now have such offer for the Australian eastcoast Sydney/Melbourne in Nov 2018 (int BSA rally).. not decided yet but we may go. We did it in 2014 to San Fransisco.

About customize the islands thats no problem except for the mysql queries bit don't like it when not understanding it. Don't like if it can corrupt the forum with no support.
Ride safe


Morgan Johansson
BritBike Forum
http://www.britbike.com/forums/ubbthreads.php
Re: Random image island [Re: Morgan] #260137 05/02/2017 4:47 PM
Joined: Jun 2006
Posts: 15,843
Gizmo Online Tapedshut
UBB.threads Developer
Online Tapedshut
UBB.threads Developer
Joined: Jun 2006
Posts: 15,843
Well, if there's free beer, I guess I need to renew my passport, lol.


I am a Web Development Contractor, I do not work for UBBCentral. I have provided free User to User Support since the beginning of these support forums.
Need to Upgrade?
Forums: A Gardeners Forum Scouters World
UBB.threads: UBBWiki, UBB Styles, UBB.Sitemaps
Longtime Supporter & Resident Post-A-Holic
VNC Web Services: Code Modifications, Upgrades, Styling, Coding Services, Disaster Recovery, and more!
Re: Random image island [Re: Morgan] #260139 05/02/2017 4:57 PM
Joined: Jun 2006
Posts: 679
Morgan Offline OP
Addict
OP Offline
Addict
Joined: Jun 2006
Posts: 679
Speaking of beer this cooler is in my little BritBike museum smile

Attached Files DSCN1297.jpg

Morgan Johansson
BritBike Forum
http://www.britbike.com/forums/ubbthreads.php
Re: Random image island [Re: Morgan] #260141 05/02/2017 5:05 PM
Joined: Jun 2006
Posts: 15,843
Gizmo Online Tapedshut
UBB.threads Developer
Online Tapedshut
UBB.threads Developer
Joined: Jun 2006
Posts: 15,843
I approve!


I am a Web Development Contractor, I do not work for UBBCentral. I have provided free User to User Support since the beginning of these support forums.
Need to Upgrade?
Forums: A Gardeners Forum Scouters World
UBB.threads: UBBWiki, UBB Styles, UBB.Sitemaps
Longtime Supporter & Resident Post-A-Holic
VNC Web Services: Code Modifications, Upgrades, Styling, Coding Services, Disaster Recovery, and more!
Re: Random image island [Re: Morgan] #260146 05/04/2017 1:12 PM
Joined: Jun 2006
Posts: 679
Morgan Offline OP
Addict
OP Offline
Addict
Joined: Jun 2006
Posts: 679
So I'm at it again and added above script.
the question now is I don't see that it changes the image that often.
The

Quote
Cache Time
In Minutes. If zero is specified, the body of this custom box will be static, ie. never updated. This setting would be used for things like links, banner ads, etc.


This is now set to 1 minute.

Quote
Portal Cache Settings
Higher cache times are better for overall forum speed. Times should be entered as minutes.
Forum Stats

Who's Online 90

Popular Topics 90

Public Calendar 90

Top Posters (All Time) 90

Top Posters (30 Days) 90


What I'm asking which is the best setting to keep the random gallery photo change continuesly?

Thanks

Last edited by Morgan; 05/04/2017 1:13 PM.

Morgan Johansson
BritBike Forum
http://www.britbike.com/forums/ubbthreads.php
Re: Random image island [Re: Morgan] #260147 05/04/2017 3:12 PM
Joined: Jun 2006
Posts: 15,843
Gizmo Online Tapedshut
UBB.threads Developer
Online Tapedshut
UBB.threads Developer
Joined: Jun 2006
Posts: 15,843
A cache setting of "1" will update it every 1 minute. It's better to have the value something larger as it's a database query every time it's updated; after testing, on A Gardeners Forum, I have mine set to 5 minutes.


I am a Web Development Contractor, I do not work for UBBCentral. I have provided free User to User Support since the beginning of these support forums.
Need to Upgrade?
Forums: A Gardeners Forum Scouters World
UBB.threads: UBBWiki, UBB Styles, UBB.Sitemaps
Longtime Supporter & Resident Post-A-Holic
VNC Web Services: Code Modifications, Upgrades, Styling, Coding Services, Disaster Recovery, and more!
Re: Random image island [Re: Morgan] #260164 05/09/2017 1:51 AM
Joined: Jun 2006
Posts: 15,843
Gizmo Online Tapedshut
UBB.threads Developer
Online Tapedshut
UBB.threads Developer
Joined: Jun 2006
Posts: 15,843
There are several items in Forum Permissions for the target forums that would affect guests, they're pretty descriptive.


I am a Web Development Contractor, I do not work for UBBCentral. I have provided free User to User Support since the beginning of these support forums.
Need to Upgrade?
Forums: A Gardeners Forum Scouters World
UBB.threads: UBBWiki, UBB Styles, UBB.Sitemaps
Longtime Supporter & Resident Post-A-Holic
VNC Web Services: Code Modifications, Upgrades, Styling, Coding Services, Disaster Recovery, and more!
Re: Random image island [Re: Gizmo] #260169 05/09/2017 11:17 AM
Joined: Mar 2007
Posts: 244
ECNet Offline
Enthusiast
Offline
Enthusiast
Joined: Mar 2007
Posts: 244
Originally Posted by Gizmo
There are several items in Forum Permissions for the target forums that would affect guests, they're pretty descriptive.

You were too quick answering me... LOL

I made a Custom Island like this last nite (replacing a Gallery Island) and the first few times I clicked on it as a Guest I got the permissions error.
I turned my Gallery Island back on and after that everything worked so I withdrew my question.. facepalm

Re: Random image island [Re: Gizmo] #260171 05/09/2017 9:54 PM
Joined: Mar 2007
Posts: 244
ECNet Offline
Enthusiast
Offline
Enthusiast
Joined: Mar 2007
Posts: 244
I did more investigation today and realized It was picking pictures from both public and private galleries.

I didn't get that at first Duh!!

blush

Re: Random image island [Re: Morgan] #260172 05/10/2017 4:31 PM
Joined: Jun 2006
Posts: 15,843
Gizmo Online Tapedshut
UBB.threads Developer
Online Tapedshut
UBB.threads Developer
Joined: Jun 2006
Posts: 15,843
Yes, the query supplied does not check the forum(s) which supply the data; I offer development services if you're interested in having something custom built.


I am a Web Development Contractor, I do not work for UBBCentral. I have provided free User to User Support since the beginning of these support forums.
Need to Upgrade?
Forums: A Gardeners Forum Scouters World
UBB.threads: UBBWiki, UBB Styles, UBB.Sitemaps
Longtime Supporter & Resident Post-A-Holic
VNC Web Services: Code Modifications, Upgrades, Styling, Coding Services, Disaster Recovery, and more!
Re: Random image island [Re: Gizmo] #261963 12/31/2018 7:40 AM
Joined: Jun 2006
Posts: 956
Zarzal Offline
Old Hand
Offline
Old Hand
Joined: Jun 2006
Posts: 956
Based on the new gallery island in V7.6.2 I use this code:
Code
/* PHP CODE HERE */
$query = "
	SELECT
		`POST_ID`, `FILE_DIR`, `FILE_NAME`
	FROM
		`{$config['TABLE_PREFIX']}FILES`
	WHERE
		`FILE_DIR`<>''
	ORDER BY
		rand()
	LIMIT
		1
";
$sth = $dbh->do_query($query,__LINE__,__FILE__);
list($postId,$fDir,$fName) = $dbh->fetch_array($sth);

/* BODY HERE */
$body = <<<EOF
<div class="p2" style="height:180px;overflow:hidden;position:relative;width:180px;display:inline-block;">
<a href="{$config['BASE_URL']}/ubbthreads.php?ubb=showgallery&Number=$postId">
<img src="{$config['BASE_URL']}/gallery/$fDir/medium/$fName" alt="" title="" class="p2 cp oi" style="position:absolute;left:-100%;right:-100%;top:-100%;bottom:-100%;margin:auto;min-height:100%;height:180px;">
</a>
</div>
EOF;

It use the medium picture for preview and crop it to a fill out the whole box.
Please note that this code scan the content of the directory on the server and display orphaned files and the threads too. This gives me a lot of work to do on my board.


my board: http://www.dragonclan-forum.de
my hobby: http://www.biker-reise.de
Ich kann bei Fragen zu UBBthreads in Deutsch weiterhelfen oder es zumindest versuchen
Re: Random image island [Re: Morgan] #262014 01/09/2019 12:26 PM
Joined: Jun 2006
Posts: 956
Zarzal Offline
Old Hand
Offline
Old Hand
Joined: Jun 2006
Posts: 956
If you dont like to be transfered to the gallery if you click the thumb picture in the island you can use the code down there. This little modification bring up the full size picture in the lightbox view include the file description (if exists). My next goal: the click should bring you to the gallery and open the selected picture in the lightbox automaticly. A combination of both code boxes. Time will tell ...

Code
/* PHP CODE HERE */
$query = "
	SELECT
		`POST_ID`, `FILE_DIR`, `FILE_NAME` , FILE_DESCRIPTION
	FROM
		`{$config['TABLE_PREFIX']}FILES`
	WHERE
		`FILE_DIR`<>''
	ORDER BY
		rand()
	LIMIT
		1
";
$sth = $dbh->do_query($query,__LINE__,__FILE__);
list($postId,$fDir,$fName,$fDesc) = $dbh->fetch_array($sth);

/* BODY HERE */
$body = <<<EOF
<div class="p2" style="height:180px;overflow:hidden;position:relative;width:180px;display:inline-block;">
<a href="{$config['BASE_URL']}/gallery/$fDir/full/$fName" data-lightbox="gallery" data-title="$fDesc">
<img src="{$config['BASE_URL']}/gallery/$fDir/medium/$fName" alt="" title="" class="p2 cp oi" style="position:absolute;left:-100%;right:-100%;top:-100%;bottom:-100%;margin:auto;min-height:100%;height:180px;">
</a>
</div>
EOF;


my board: http://www.dragonclan-forum.de
my hobby: http://www.biker-reise.de
Ich kann bei Fragen zu UBBthreads in Deutsch weiterhelfen oder es zumindest versuchen

Forum Search
ShoutChat Box
Comment Guidelines: Do post respectful and insightful comments. Don't flame, hate, spam.
Recent Topics
Who's On Line Issue
by Larry Miller - 09/21/2019 9:37 PM
ubb.threads 7.7.3 install error on create tables
by andrewjs18 - 09/17/2019 3:39 AM
Horizontal Image Attachment
by ECNet - 09/11/2019 12:17 PM
user profile, after I click Update nothing happens
by PianoWorld - 09/10/2019 12:38 PM
Who's Online Now
1 registered members (Gizmo), 79 guests, and 376 spiders.
Key: Admin, Global Mod, Mod
Random Gallery Image
Latest Gallery Images
Artistic structures
Artistic structures
by isaac, August 29
Stones
Stones
by isaac, August 19
Amusing Terain Scenics
Amusing Terain Scenics
by isaac, August 19
Sky places
Sky places
by isaac, August 19
Powered by UBB.threads™ PHP Forum Software 7.7.3