Go Back    Forum > Digital Publishing / Web Sites > Website and Server Troubleshooting

Reply
 
LinkBack Thread Tools
  #1  
06-01-2011, 04:20 AM
admin's Avatar
admin admin is offline
Site Staff | Web Development
 
Join Date: Jul 2003
Posts: 4,310
Thanked 654 Times in 457 Posts
Forums like The Digital FAQ are designed to a fixed width, so when somebody uploads an image that is too large for our design, it causes the page to stretch, which in turns creates vertical scroll bars, and tends to botch up the clean design. This only happens on images/photos linked with the IMG bbcode, and not properly attached to the forum.

Site note: Ideally, we never want our users to hotlink images to other sites anyway! (Why? Well, those other sites cannot be trusted! We want to archive information here forever, for the benefit of all readers now and far into the future. If a hotlinked image breaks, the post could become useless. There's also the ethical dilemma of bandwidth theft.)

Anyway, vBulletin 3.x can be hacked pretty easily to resize photos:


Step 1 -- Open %forumpath%\includes\class_bbcode.php

Step 2 -- Locate this text:
PHP Code:
        return '<img src="' .  $link '" border="0" alt="" />'
Step 3 -- Replace with this text:
PHP Code:
//        return '<img src="' .  $link . '" border="0" alt="" />';
        
return '<img src="' .  $link '" onload="if(this.width > 800) {this.width=800;this.alt=\'Click here to see a large version\';}" onmouseover="if(this.alt) this.style.cursor=\'pointer\';" onclick="if(this.alt) window.open(\'' $link '\');" border="0" />'
Note the image size. In our case, it's 800. Change it to whatever you would like.

Yes, we also suggest commenting out old default code (the "//" marks) and not deleting it!

When the page first loads, the image will be full sized, and resize happens on pageload completion. If your Internet connection is fast, it will be only a portion of a second. If the image is far down the page, you might not even know it's happening. If the page loads slow -- which may happen due to the slowness of the site where the images are linked from!!! -- then you'll see it load big, then shrink down again. So it's not 100% perfect, but it's better than the alternatives: sloppy vB.org plugins, shoddy template hacks, or simply disabling IMG bbcode entirely. Some of those plugins/mods may actually break your database! (It happens to us in 2009, forcing a db restore from the backup that was taken just prior to the plugin install. Hint: ALWAYS back up your database before "hacking" your own site code!)

This may or may not work in vBulletin 4.x. From what I've seen, this may finally be integrated into the default core. (FINALLY!)

Again, please attach files.

- Did this site help you? Then upgrade to Premium Member and show your support!
- Also: Like Us on Facebook for special DVD/Blu-ray news and deals!
Reply With Quote
Someday, 12:01 PM
admin's Avatar
Ads / Sponsors
 
Join Date: ∞
Posts: 42
Thanks: ∞
Thanked 42 Times in 42 Posts
Reply




Similar Threads
Thread Thread Starter Forum Replies Last Post
Scanning with ICE vs no ICE [Sample Images] kpmedia Photo Processing, Scanning & Printing 11 03-25-2010 07:33 PM
Need resize filter for VitualDub Dewey Encode, Convert for discs 2 03-09-2009 03:17 AM
Background images with orange swirl design ndbs9u3 Author, Make Menus, Slideshows, Burn 2 12-11-2007 08:34 PM
Jittery/Shaky DVD Menu Images Konfusion Author, Make Menus, Slideshows, Burn 4 07-22-2007 12:40 AM
Jittery/choppy images w/ old VHS Triassical Capture, Record, Transfer 3 11-13-2004 06:13 PM

Thread Tools



 
All times are GMT -5. The time now is 10:32 AM