Raised This Month: $32 Target: $400
 8% 

Automatic Image Resizing


  
 
 
Thread Tools Display Modes
Author Message
FlyingMongoose
Veteran Member
Join Date: Mar 2004
Old 09-26-2006 , 12:01   Automatic Image Resizing
#1

I've noticed pages/posts expanding beyond the limitations of the layout (this has bothered me personally in my vBulletin installation). So I went out searching for the fix...and I found it, here's the auto-resize fix.

in the following file
includes/class_bbcode.php

Find in line (about 18xx)
PHP Code:
return '<img src="' .  $link '" border="0" alt="" />'
Replace that line with the following line.
PHP Code:
return '<img src="' $link '" onload="if(largerThan(this.width,700)) {this.width=650;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" />'
This will automaticall resize and output the images, if clicked on, they open full size in a new window.

Of course, change the width in "this.width" definitions to fit your layout.

While this may not be the most efficient way of doing this (especially for the end client) it still resolves the issue. Other options include more sys resource intensive solutions, involving ImageMagic or some other form of server side graphics manipulation.

If this doesn't work, I may have accidentally skipped a step...I'm trying to remember if there's anything I may have missed.

Last edited by FlyingMongoose; 09-26-2006 at 12:05.
FlyingMongoose is offline
Brad
AMX Mod X Team Member
Join Date: Jun 2004
Old 09-26-2006 , 13:24   Re: Automatic Image Resizing
#2

Which browsers did you test with?
__________________
Brad is offline
FlyingMongoose
Veteran Member
Join Date: Mar 2004
Old 09-27-2006 , 00:28   Re: Automatic Image Resizing
#3

FireFox and IE, seems to work for me.

Haven't tested on any other browsers.
FlyingMongoose is offline
Janet Jackson
Veteran Member
Join Date: Mar 2005
Location: far, far away from here
Old 10-01-2006 , 20:36   Re: Automatic Image Resizing
#4

Works in Opera as well, not sure about Konquerer and Safari. But I assume they work in every browser that has active scripting enabled. I use this :
PHP Code:
return '<img src="' $link '" onload="if(this.width > 600) {this.width=600;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" />'
__________________
Janet Jackson is offline
 



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 05:35.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode