Previous Thread
Next Thread
Print Thread
Rate Thread
Joined: Jul 2002
Posts: 12
Newbie
Newbie
Offline
Joined: Jul 2002
Posts: 12
Author: Kayjey (www.straydesign.com)
Version: v0.9 RC

About:
Big images can ruin the layout of a Forum. While loading, they also can cause the layout to shift. I've created this custom tag and linked popup that will display an image thumbnail (browser-resized) and links it to a large popup for that image.

Installation:
There's two parts to this.

Step 1
Download www.straydesign.com/customers/misc/ubb-imagepopup.zip

Unzip and upload the PHP file into your root 'forum' folder. (It does not need editing.)

Step 2
In the Forum Control Panel, go to 'content rebuilder', tab 'custom tags' and create a new 'custom tag'

Enabled = yes
Show in menu = probably yes
Custom tag = imgpop
Menu description = Image Popper
User prompt hint = Enter full image URL.
Matching regex = (.+?)
Resulting markup =
Quote
<a href="http://www.fccuk.org/forum/imagepopup.php?image=\\1" onclick="window.open('http://www.EXAMPLE.COM/FORUM/imagepopup.php?image=\\1', 'imagepopup', 'toolbar=no,scrollbars=no,width=300,height=300'); return false;"><img src="\\1" style="border: 1px solid black; padding: 5px;" height="60" vspace="5" alt="click to enlarge"></a>


NOTE
You should replace "EXAMPLE.COM/FORUM" with your own UBB URL. (In here it would be "ubbdev.com/forums".)

Usage
Use it on your Forum by using the Media button in your post/edit box and select "Image Popper".

Straight code:
Quote
[imgpop]full url to my image[/imgpop]

Development phase
This has been tested to work with most image hosts. Although it should work 100%, I'll update when there's something annoying that needs a fix. Or when I get suggestions...

Demo
http://www.fccuk.org/forum/ubbthreads.php?ubb=showflat&Number=770874#Post770874

Sponsored Links
Joined: Mar 2000
Posts: 21,079
Likes: 3
I type Like navaho
I type Like navaho
Joined: Mar 2000
Posts: 21,079
Likes: 3
Very nice Kayjey! Thank you for sharing! thumbsup


- Allen wavey
- What Drives You?
Joined: Aug 2000
Posts: 1,609
Addict
Addict
Offline
Joined: Aug 2000
Posts: 1,609
Sweet little toy you have there. Would there be a way to have all embedded images do this automatically?

Joined: Jul 2002
Posts: 12
Newbie
Newbie
Offline
Joined: Jul 2002
Posts: 12
For that, you would have to alter the IMG tag parser. *might* be just a matter of editing bbcode.inc.php and convert the line

return sprintf('<img src="%s" %s alt="" />', $url, $align);

into

return sprintf('<a href="http://www.fccuk.org/forum/imagepopup.php?image=%s" onclick="window.open(\'http://www.EXAMPLE.COM/FORUM/imagepopup.php?image=%s\', \'imagepopup\', \'toolbar=no,scrollbars=no,width=300,height=300\'); return false;"><img src="%s" style="border: 1px solid black; padding: 5px;" height="60" vspace="5" alt="click to enlarge"></a>', $url, $align);

And upload the PHP script provided.

Am actually pretty sure you'll have to check out that "sprintf" thingy and take out the 'align' stuff AND/OR just make it so that images don't have the option of being floating. I'm sure someone else will jump in and give you a solution for this. I'm not going to try this out on my live board to be honest. For one thing, we don't allow inline images - only this image thumbnail thingy.

Last edited by Kayjey; 02/13/2009 7:00 AM. Reason: correct last paragraph
Joined: Jul 2002
Posts: 12
Newbie
Newbie
Offline
Joined: Jul 2002
Posts: 12
In fact you could just go into standard_text_editor.tpl and edit the line below "{if $allow_images}"

instead of

onclick="showHTML('image','image-drop')";

just put

onclick="DoPrompt('bbcode','Enter full image URL.','[imgpop]','[/imgpop]');"



Do mind I suspect an error in the $allow_images code somewhere as the button is ALWAYS show regardless of permissions. Also any checks on total number of images will be GONE as you're no longer using the IMG tag this is checked against. Also users that aren't allowed to insert images will still be able to do it through the imgpop tag. But it's a quick and easy edit to make like this. wink

Sponsored Links

Link Copied to Clipboard
Donate Today!
Donate via PayPal

Donate to UBBDev today to help aid in Operational, Server and Script Maintenance, and Development costs.

Please also see our parent organization VNC Web Services if you're in the need of a new UBB.threads Install or Upgrade, Site/Server Migrations, or Security and Coding Services.
Recommended Hosts
We have personally worked with and recommend the following Web Hosts:
Stable Host
bluehost
InterServer
Visit us on Facebook
Member Spotlight
Gizmo
Gizmo
Portland, OR, USA
Posts: 5,833
Joined: January 2000
Forum Statistics
Forums63
Topics37,573
Posts293,925
Members13,849
Most Online5,166
Sep 15th, 2019
Today's Statistics
Currently Online
Topics Created
Posts Made
Users Online
Birthdays
Top Posters
AllenAyres 21,079
JoshPet 10,369
LK 7,394
Lord Dexter 6,708
Gizmo 5,833
Greg Hard 4,625
Top Posters(30 Days)
Top Likes Received
isaac 82
Gizmo 20
Brett 7
WebGuy 2
Morgan 2
Top Likes Received (30 Days)
None yet
The UBB.Developers Network (UBB.Dev/Threads.Dev) is ©2000-2024 VNC Web Services

 
Powered by UBB.threads™ PHP Forum Software 8.0.0
(Preview build 20221218)