Previous Thread
Next Thread
Print Thread
Hop To
#260118 05/02/2017 8:39 AM
Joined: Jun 2006
Posts: 987
Likes: 24
Old Hand
Old Hand
Joined: Jun 2006
Posts: 987
Likes: 24
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
https://www.britbike.com/forums/ubbthreads.php
Joined: Jun 2006
Posts: 16,292
Likes: 116
UBB.threads Developer
UBB.threads Developer
Joined: Jun 2006
Posts: 16,292
Likes: 116
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.
Do you need Forum Install or Upgrade Services?
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!
Joined: Jun 2006
Posts: 987
Likes: 24
Old Hand
Old Hand
Joined: Jun 2006
Posts: 987
Likes: 24
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
https://www.britbike.com/forums/ubbthreads.php
Joined: Jun 2006
Posts: 16,292
Likes: 116
UBB.threads Developer
UBB.threads Developer
Joined: Jun 2006
Posts: 16,292
Likes: 116
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.
Do you need Forum Install or Upgrade Services?
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!
Joined: Jun 2006
Posts: 987
Likes: 24
Old Hand
Old Hand
Joined: Jun 2006
Posts: 987
Likes: 24
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
https://www.britbike.com/forums/ubbthreads.php
Joined: Jun 2006
Posts: 16,292
Likes: 116
UBB.threads Developer
UBB.threads Developer
Joined: Jun 2006
Posts: 16,292
Likes: 116
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.
Do you need Forum Install or Upgrade Services?
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!
Joined: Jun 2006
Posts: 987
Likes: 24
Old Hand
Old Hand
Joined: Jun 2006
Posts: 987
Likes: 24
ok my prefix is ubbt_bbf so I should use ubbt_bbfFILES
I will try that once


Morgan Johansson
BritBike Forum
https://www.britbike.com/forums/ubbthreads.php
Joined: Apr 2004
Posts: 1,945
Likes: 145
UBB.threads Developer
UBB.threads Developer
Joined: Apr 2004
Posts: 1,945
Likes: 145
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
Current Release: UBBT 7.7.5 // Preview: UBBT 8.0.0
isaac @ id242.com // my forum @ CelicaHobby.com
Joined: Jun 2006
Posts: 987
Likes: 24
Old Hand
Old Hand
Joined: Jun 2006
Posts: 987
Likes: 24
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
https://www.britbike.com/forums/ubbthreads.php
Joined: Jun 2006
Posts: 16,292
Likes: 116
UBB.threads Developer
UBB.threads Developer
Joined: Jun 2006
Posts: 16,292
Likes: 116
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.
Do you need Forum Install or Upgrade Services?
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!
Joined: Jun 2006
Posts: 987
Likes: 24
Old Hand
Old Hand
Joined: Jun 2006
Posts: 987
Likes: 24
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
https://www.britbike.com/forums/ubbthreads.php
Joined: Apr 2004
Posts: 1,945
Likes: 145
UBB.threads Developer
UBB.threads Developer
Joined: Apr 2004
Posts: 1,945
Likes: 145
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
Current Release: UBBT 7.7.5 // Preview: UBBT 8.0.0
isaac @ id242.com // my forum @ CelicaHobby.com
Joined: Jun 2006
Posts: 987
Likes: 24
Old Hand
Old Hand
Joined: Jun 2006
Posts: 987
Likes: 24
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
https://www.britbike.com/forums/ubbthreads.php
Joined: Jun 2006
Posts: 16,292
Likes: 116
UBB.threads Developer
UBB.threads Developer
Joined: Jun 2006
Posts: 16,292
Likes: 116
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.
Do you need Forum Install or Upgrade Services?
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!
Joined: Jun 2006
Posts: 987
Likes: 24
Old Hand
Old Hand
Joined: Jun 2006
Posts: 987
Likes: 24
Speaking of beer this cooler is in my little BritBike museum smile
Attachments
DSCN1297.jpg


Morgan Johansson
BritBike Forum
https://www.britbike.com/forums/ubbthreads.php
Joined: Jun 2006
Posts: 16,292
Likes: 116
UBB.threads Developer
UBB.threads Developer
Joined: Jun 2006
Posts: 16,292
Likes: 116
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.
Do you need Forum Install or Upgrade Services?
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!
Joined: Jun 2006
Posts: 987
Likes: 24
Old Hand
Old Hand
Joined: Jun 2006
Posts: 987
Likes: 24
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
https://www.britbike.com/forums/ubbthreads.php
Joined: Jun 2006
Posts: 16,292
Likes: 116
UBB.threads Developer
UBB.threads Developer
Joined: Jun 2006
Posts: 16,292
Likes: 116
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.
Do you need Forum Install or Upgrade Services?
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!
Joined: Jun 2006
Posts: 16,292
Likes: 116
UBB.threads Developer
UBB.threads Developer
Joined: Jun 2006
Posts: 16,292
Likes: 116
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.
Do you need Forum Install or Upgrade Services?
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!
Gizmo #260169 05/09/2017 11:17 AM
Joined: Mar 2007
Posts: 285
Likes: 1
E
Enthusiast
Enthusiast
E Offline
Joined: Mar 2007
Posts: 285
Likes: 1
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

Joined: Mar 2007
Posts: 285
Likes: 1
E
Enthusiast
Enthusiast
E Offline
Joined: Mar 2007
Posts: 285
Likes: 1
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

Joined: Jun 2006
Posts: 16,292
Likes: 116
UBB.threads Developer
UBB.threads Developer
Joined: Jun 2006
Posts: 16,292
Likes: 116
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.
Do you need Forum Install or Upgrade Services?
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!
Joined: Jun 2006
Posts: 956
Old Hand
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
Morgan #262014 01/09/2019 12:26 PM
Joined: Jun 2006
Posts: 956
Old Hand
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
Joined: Sep 2006
Posts: 165
L
Member
Member
L Offline
Joined: Sep 2006
Posts: 165
I am trying to have a random photo gallery so I copied and pasted the code above and get a nice blank content island smile

I am using 7.7.4

Does the code in the above post work with this latest version? I dont know PHP. Any help is appreciated.

Joined: Apr 2004
Posts: 1,945
Likes: 145
UBB.threads Developer
UBB.threads Developer
Joined: Apr 2004
Posts: 1,945
Likes: 145
As of 2020-03-07 (last updated/file date), the Custom Portal Island code for "Random Gallery Image" used on UBBCentral is:

Code
/* PHP CODE HERE */

$query = "
	SELECT POST_ID, FILE_DIR, FILE_NAME
	FROM {$config['TABLE_PREFIX']}FILES
	WHERE (FILE_DIR <> '' AND FILE_DIR IS NOT NULL)
	  AND (FILE_TYPE = 'jpg'
	   OR FILE_TYPE = 'gif'
	   OR FILE_TYPE = 'jpg'
	   OR FILE_TYPE = 'jpeg'
	   OR FILE_TYPE = 'png')
	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="acvt">
<div style="height:{$config['MAX_THUMB_W_H']}px;overflow:hidden;position:relative;width:100%;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;max-width:280px;min-height:100%;"></a>
</div>
</div>

EOF;
Attachments
20200510_14-08-45.PNG


Current developer of UBB.threads PHP Forum Software
Current Release: UBBT 7.7.5 // Preview: UBBT 8.0.0
isaac @ id242.com // my forum @ CelicaHobby.com
1 member likes this: Gizmo
Joined: Jun 2006
Posts: 987
Likes: 24
Old Hand
Old Hand
Joined: Jun 2006
Posts: 987
Likes: 24
Isaac, I added above code and it is better that previous so Thank you!!!


Morgan Johansson
BritBike Forum
https://www.britbike.com/forums/ubbthreads.php
1 member likes this: isaac

Link Copied to Clipboard
ShoutChat
Comment Guidelines: Do post respectful and insightful comments. Don't flame, hate, spam.
Recent Topics
spam issues
by ECNet - 03/19/2024 11:45 PM
Looking for a forum
by azr - 03/15/2024 11:26 PM
Editing Links in Post
by Outdoorking - 03/15/2024 9:31 AM
Question on barkrowler and the like
by Mors - 02/29/2024 6:51 PM
Member Permissions Help
by domspeak - 02/27/2024 6:31 PM
Who's Online Now
2 members (Havenofsobriety, rootman), 624 guests, and 106 robots.
Key: Admin, Global Mod, Mod
Random Gallery Image
Latest Gallery Images
Los Angeles
Los Angeles
by isaac, August 6
3D Creations
3D Creations
by JAISP, December 30
Artistic structures
Artistic structures
by isaac, August 29
Stones
Stones
by isaac, August 19
Powered by UBB.threads™ PHP Forum Software 8.0.0
(Preview build 20230217)