Register Members List Search Today's Posts Mark Forums Read

Reply
 
Mod Options
Wide image automatic resize for html and vB tags in posts - fixes template problems Details »»
Wide image automatic resize for html and vB tags in posts - fixes template problems
Mod Version: 1.00, by Steve St.Lauren (Member) Steve St.Lauren is offline
Developer Last Online: Mar 2013 I like it Show Printable Version Email this Page

This modification is in the archives.
vB Version: 3.0.8 Rating: (0 vote - 0 average) Installs: 111
Released: 29 Jul 2004 Last Update: 10 Sep 2004 Downloads: 80
Not Supported  

Having trouble with large images in [img] or <img src> tags in your posts causing your templates to go too wide causing a horizontal scroll bar for all posts? I have many users that attach large images to their posts either through vB img or html img src tags. In vB2 it wasn't that much of an issue because it only caused their post to go wide causing a horizontal scroll bar. In vB3 it causes all the posts on that thread to go to that width.

This hack uses the img src width="xx" tag to resize the picture to whatever max size you wish. It also adds a link to the full size image in it's original location and retains any extra formatting the user puts in the tag. In addition it checks to see if the picture actually exists and if not show "Image link is broken" where the picture would have been. Please click install if you install it and please give feedback so I can go full release with it if it's bug free.

Updated on 07/30/2004 - R0.9
Updated on 08/06/2004 - R1.0 - Identical to R.9, no need to upgrade just changing to full release from beta
Updated on 08/10/2004 - R1.1 - Added max_imgsize to the 2nd section of code (and removed global max_imgsize line from both), some users had problems with the code grabbing the max_imgsize from the first section - this fixes that.
Updated on 09/09/2004 - R1.2 - fixed problem with duplicating the resize notice when using wysiwyg editor

Download Now

Only licensed members can download files, Click Here for more information.

Screenshots

Click image for larger version

Name:	imagesizescrnshot.jpg
Views:	2180
Size:	64.3 KB
ID:	19927

Show Your Support

  • To receive notifications regarding updates -> Click to Mark as Installed.
  • This modification may not be copied, reproduced or published elsewhere without author's permission.
Comments
  #2  
Old 29 Jul 2004, 08:43
Bryan Ex's Avatar
Bryan Ex Bryan Ex is offline
 
Join Date: Feb 2004
Location: Canada
Sounds perfect! I'll get it added to my board later today to try it out.
Reply With Quote
  #3  
Old 29 Jul 2004, 09:36
Aurous Aurous is offline
 
Join Date: Apr 2004
Angry

Well written code, but pages load really slow! Not good for a big site.

Heres what Ive done, which works on client-side:


Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.


Thats it. It works fine, but if the images load from your cache, this fails! If theres something that can be done to cached images, this code will work perfectly!

Last edited by Aurous : 02 Dec 2004 at 23:40.
Reply With Quote
  #4  
Old 29 Jul 2004, 10:01
Steve St.Lauren Steve St.Lauren is offline
 
Join Date: May 2002
I guess I'll find out because our site hits peaks of 800 users online, over 1,000,000 hits per day, and 900,000 posts. It's the best option I've come up with. I just loaded a page with 30 posts on it and 17 large linked images and the page generated in 4.8 seconds with 10 queries. We have very few threads with that many pictures in them. Most of the time it's one or two pictures. A thread with 1 picture generated in .635 seconds with 9 queries.

Last edited by Steve St.Lauren : 29 Jul 2004 at 10:04.
Reply With Quote
  #5  
Old 29 Jul 2004, 10:23
Aurous Aurous is offline
 
Join Date: Apr 2004
Our site is on a xeon server with over 3.5 million hits per day, therefore anything that adds more server load will be a disaster for us at the moment. I'd like these image size checks to be done on client side and not server side. Wasting server resources on images is just not useful for our site. But anyways, I am sure a lot of other sites will find this hack useful. Good work and I hope to see more improvements in the future.

Aurous
Reply With Quote
  #6  
Old 29 Jul 2004, 11:41
nexialys
Guest
 
what would be the most efficient is to have a third image generated, between the thumbnail size and the original... like in photopost or other galleries... so no need to resize the images each time they are displayed...
Reply With Quote
  #7  
Old 29 Jul 2004, 11:49
Intex Intex is offline
 
Join Date: Apr 2002
Steve - looks good. Have it been tested with 3.0.1?
Reply With Quote
  #8  
Old 29 Jul 2004, 19:25
Steve St.Lauren Steve St.Lauren is offline
 
Join Date: May 2002
No it hasn't been test on 3.0.1 because I'm running 3.03 but I don't see any reason why it wouldn't work. If you try it please report back. It would be easy to roll it back because there is only one line of original code that's deleted and I have that line of code in a comment in the new code.

nexialys - I agree that would be the most efficient but there are problems with doing that. If the user changed the image after the fact your "large thumbnail" wouldn't update. A user could use this to post a link to a picture that you wouldn't want to have on your site. The only way around that would be to store the entire image and the large thumbnail on your server but then your taking the entire bandwidth bill onto your hands for potentially very large images but it could be done.
Reply With Quote
  #9  
Old 30 Jul 2004, 09:20
Steve St.Lauren Steve St.Lauren is offline
 
Join Date: May 2002
Well, I found a problem tonight. If the remote server that the image is on is down then fopen stalls when looking for the file. I'm looking for a workaround for that now. If anyone has any ideas help would be appreciated.
Reply With Quote
  #10  
Old 30 Jul 2004, 11:26
Natch's Avatar
Natch Natch is offline
 
Join Date: Nov 2002
There might be a solution in the code in the Links Database hack ...
__________________
Natcher00
... is the Admin @ MobileForces.org - Official Community for a cult Vehicle based FPS - the only place for support!
... also he's Penfold to Dark_Wizard's Danger Mouse in development of vBWar
http://www.mobileforces.org/sig.jpg
{DaniWeb: Learn HOW-TO mod_rewrite your vB board}
Reply With Quote
  #11  
Old 30 Jul 2004, 14:40
NietzscheKid NietzscheKid is offline
 
Join Date: Jun 2002
Originally Posted by Natch
There might be a solution in the code in the Links Database hack ...
Damn. This is awesome. I am going to test it out. Thanks so much for this hack.
Reply With Quote
  #12  
Old 30 Jul 2004, 16:00
`SLVR`'s Avatar
`SLVR` `SLVR` is offline
 
Join Date: Aug 2003
sounds great, im definitly gonna use this
Reply With Quote
  #13  
Old 30 Jul 2004, 20:02
Steve St.Lauren Steve St.Lauren is offline
 
Join Date: May 2002
I just uploaded a new version that fixes the server down problem. It now checks to see if the server is up first. If it cannot connect to the server after 5 seconds it returns "Image server is down" so the users know why it took longer to generate the page. This was the best solution I could come up with for this. I also added a release # in the title and end of the hack lines of code to keep track of where it's at. Right now this is R0.9 - the original had no release number. Please update to the latest version.

Let me know how it's working for you too, please.
Reply With Quote
  #14  
Old 31 Jul 2004, 02:33
cinq's Avatar
cinq cinq is offline
 
Join Date: Oct 2002
Using R0.9 on a vb3.0.1 board with no problems ( did a couple of comestic changes, the font size, opening the oversized image in a new window, and the table for displaying image link broken or server down )

Good job Steve !
Reply With Quote
  #15  
Old 31 Jul 2004, 04:15
alkatraz alkatraz is offline
 
Join Date: Oct 2002
Location: Vancouver, Canada
Real name: Colin
awesome hack!
__________________
-alkatraz
Northwest Nissans Classifeds
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
Mod Options

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


New To Site? Need Help?

All times are GMT. The time now is 03:00.

Layout Options | Width: Wide Color: