Previous Thread
Next Thread
Print Thread
Hop To
Joined: Dec 2003
Posts: 117
K
Member
Member
K Offline
Joined: Dec 2003
Posts: 117
Since I hate the fact that images can ruin the layout of a Forum + that while loading, the whole layout can shift about, I've created this custom tag which will display an image thumbnail (browser-resized) and links it to a large popup for that image. I was asked to share it here.

There's two parts to this. First download this:
www.straydesign.com/customers/misc/ubb-imagepopup.zip

Upload the enclosed PHP file into your root 'forum' folder. It does not need editing.

Then in control panel, go to 'content rebuilder' and add a new 'custom tag'

Enabled = yes
Show in meny = 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.YOURSERVER.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>


Where you would replace "YOURSERVER.COM/FORUM" with your own URL. (In here it would be "ubbcentral.com/forums".)

Use it on your Forum by using the Media button in your post/edit box. Or do:
Quote
[imgpop]full url to my image[/imgpop]

I'm just fully testing this as we speak, it should work quite well, but I'll update when there's something annoying that needs a fix.

If you need a demo link, just go here:
http://www.fccuk.org/forum/ubbthreads.php?ubb=showflat&Number=770874#Post770874

Joined: Jun 2006
Posts: 16,299
Likes: 116
UBB.threads Developer
UBB.threads Developer
Joined: Jun 2006
Posts: 16,299
Likes: 116
This seems to be more of a ubbdev type thing (addon/mod)


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: Dec 2003
Posts: 117
K
Member
Member
K Offline
Joined: Dec 2003
Posts: 117
I'll add it there. Note I've just updated the popup window code to resize correctly in (I would guess most popular) browsers.

Joined: Aug 2006
Posts: 1,358
Y
Veteran
Veteran
Y Offline
Joined: Aug 2006
Posts: 1,358
Isn't possible to do this with lightbox?


[Linked Image from siemons.org]
Joined: Apr 2007
Posts: 3,940
Likes: 1
SD Offline
Former Developer
Former Developer
Joined: Apr 2007
Posts: 3,940
Likes: 1
yes, i use lightbox and it's very simple with just adding to the class in the link smile

you hardly have to modify any code at all wink

Joined: Aug 2006
Posts: 1,358
Y
Veteran
Veteran
Y Offline
Joined: Aug 2006
Posts: 1,358
Originally Posted by Sirdude
you hardly have to modify any code at all wink


Too bad laugh wink


[Linked Image from siemons.org]
Joined: Mar 2008
Posts: 326
D
Enthusiast
Enthusiast
D Offline
Joined: Mar 2008
Posts: 326
I've hooked this up with lightbox and it works stupendously.... however... it would be swell if it could somehow actually resize the image instead of a browser resize, but that would be a lot more in-depth and would require using ImageMagick, GD2, etc.

Joined: Dec 2003
Posts: 117
K
Member
Member
K Offline
Joined: Dec 2003
Posts: 117
... and a lot of bandwidth. I actually had a version running like that, using a second PHP script which I set as the img src for the thumbnail, generating a thumbnail through that script. But I decided not to take up the traffic of running 4MB pictures straight-from-the-camera through our server.

Also proportionally resizing the image correctly is easy, but I wanted to actually resize and crop it into a 80x80 box, so that I could have a fixed thumbnail width and height (to get rid of any change of having the layout sliding around while loading the iamge), but couldn't get it 100% correct.

If anyone can come up with a PHP script that resizes the shortest side of the image to a fixed amount of pixels and crops off the longest side (centered) to the same amount, I would be happy to offer the adapted code on here.

Joined: Mar 2008
Posts: 326
D
Enthusiast
Enthusiast
D Offline
Joined: Mar 2008
Posts: 326
I've left my default upload limit value of 2MB in my php.ini. I have 2MB as the limit in the board software as well since my users often upload MP3s of the music they have written. We're not a photography site, so there is no reason to have anything higher than 2MB; in fact, 2MB is still rather large for image files for my Website's purposes AFAIC.

Even with the galleries, users are still going to want to attach image files to "regular" forum posts as well. I'm hankerin' for making (or having made) something that will handle thumb-nailing on a file level and not just HTML re-sizing (which should be illegal, IMHO.) wink

I've never read into ImageMagick and its related scripting; maybe this will be a reason for me to.

This brings up an idear -- perhaps it would be a good thing to be able to set file-size limits based on file-type...

Joined: Dec 2003
Posts: 117
K
Member
Member
K Offline
Joined: Dec 2003
Posts: 117
It's easy to script an image resizer. Does the php ini filesize limit also limit the file sizes of external images it can 'get'?

http://www.phptoys.com/e107_plugins/content/content.php?content.46


Link Copied to Clipboard
ShoutChat
Comment Guidelines: Do post respectful and insightful comments. Don't flame, hate, spam.
Recent Topics
Bots
by Outdoorking - 04/13/2024 5:08 PM
Can you add html to language files?
by Baldeagle - 04/07/2024 2:41 PM
Do I need to rebuild my database?
by Baldeagle - 04/07/2024 2:58 AM
This is not a bug, but a suggestion
by Baldeagle - 04/05/2024 11:25 PM
spam issues
by ECNet - 03/19/2024 11:45 PM
Who's Online Now
1 members (Ruben), 866 guests, and 176 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)