Go Back   vb.org Archive > vBulletin Modifications > Archive > vB.org Archives > vBulletin 3.0 > vBulletin 3.0 Full Releases
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools
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
Version: 1.00, by Steve St.Lauren Steve St.Lauren is offline
Developer Last Online: Mar 2013 Show Printable Version Email this Page

Version: 3.0.8 Rating:
Released: 07-28-2004 Last Update: 09-09-2004 Installs: 111
 
No support by the author.

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

Show Your Support

  • This modification may not be copied, reproduced or published elsewhere without author's permission.

Comments
  #52  
Old 09-10-2004, 06:34 AM
Steve St.Lauren Steve St.Lauren is offline
 
Join Date: May 2002
Posts: 105
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I had an error in one of the edits that duplicated a few lines. I've fixed it in the file.
Reply With Quote
  #53  
Old 09-12-2004, 10:32 AM
QATAR SPEED QATAR SPEED is offline
 
Join Date: Jun 2004
Location: QATAR
Posts: 16
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

YOU MADE MY DAY :up: Thanks

This Hack should be a Stander hack on any coming VB vir

and it would be nice if there an option on the Admin CP to control the size of the img.

one more thing ..

how can i make the img open in a new window?

*INSTALL*
Reply With Quote
  #54  
Old 09-13-2004, 01:42 AM
Steve St.Lauren Steve St.Lauren is offline
 
Join Date: May 2002
Posts: 105
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by QATAR SPEED
how can i make the img open in a new window?
Look back earlier in this thread where a guy asked how to make it target="_blank" - the instructions I left after that will do just what you are looking for.
Reply With Quote
  #55  
Old 09-14-2004, 08:23 AM
QATAR SPEED QATAR SPEED is offline
 
Join Date: Jun 2004
Location: QATAR
Posts: 16
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

done, thanks
Reply With Quote
  #56  
Old 09-14-2004, 10:17 PM
ntwrkguy ntwrkguy is offline
 
Join Date: Jan 2004
Posts: 2
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I just installed this as per the attachment and now I'm getting

Warning: Missing argument 2 for handle_bbcode_img_match() in /usr/home/ntwrkguy/public_html/motormanforum/includes/functions_bbcodeparse.php on line 1116


Line 1116 reads
Code:
function handle_bbcode_img_match($link, $iswysiwyg)
as part of the larger mod which requires us to put in
Code:
// Image size hack R1.2
// Modified by SS
// function handle_bbcode_img_match($link)
function handle_bbcode_img_match($link, $iswysiwyg)
//
Help?
Reply With Quote
  #57  
Old 09-15-2004, 02:34 AM
Steve St.Lauren Steve St.Lauren is offline
 
Join Date: May 2002
Posts: 105
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

You missed doing the part of the hack on lines 153-163 in the hack:

Quote:
In the same file look for this line (around line 1101 after the above change is made):

$bbcode = preg_replace('#\[img\]\s*(https?://([^<>*"' . iif(!$vboptions['allowdynimg'], '?&') . ']+|[a-z0-9/\\._\- !]+))\[/img\]#iUe', "handle_bbcode_img_match('\\1')", $bbcode);

replace with:

// Image size hack R1.2
// Modified by SS
// $bbcode = preg_replace('#\[img\]\s*(https?://([^<>*"' . iif(!$vboptions['allowdynimg'], '?&') . ']+|[a-z0-9/\\._\- !]+))\[/img\]#iUe', "handle_bbcode_img_match('\\1')", $bbcode);
$bbcode = preg_replace('#\[img\]\s*(https?://([^<>*"' . iif(!$vboptions['allowdynimg'], '?&') . ']+|[a-z0-9/\\._\- !]+))\[/img\]#iUe', "handle_bbcode_img_match('\\1',$iswysiwyg)", $bbcode);
//
That's the only place that handle_bbcode_img_match is called from. I italicized and bolded the part of that line that is added.
Reply With Quote
  #58  
Old 09-17-2004, 06:42 AM
HaloImpulse HaloImpulse is offline
 
Join Date: Jul 2004
Posts: 48
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Parse error: parse error, unexpected $ in /home/haloimp/public_html/includes/functions_bbcodeparse.php on line 1738

linke 1738 is ?>

wtf?
Reply With Quote
  #59  
Old 09-17-2004, 04:39 PM
Steve St.Lauren Steve St.Lauren is offline
 
Join Date: May 2002
Posts: 105
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Check over the hack - you missed something. Specifically look at the lines that start with "function handle_bbcode_img" and "function handle_bbcode_img_match". If you look in the hack directions you are supposed to replace those lines with the lines in the hack. You probably have those lines duplicated - a couple of other people have done that as well. I had an error in the hack instructions that were there for about 6 hours when I first put up this version so if you downloaded it when I first put this version up download it again. If you can't figure it out let me know and I'll PM you my email address so you can send me your functions_bbcodeparse.php file and I'll figure out what's wrong.
Reply With Quote
  #60  
Old 09-18-2004, 01:19 AM
HaloImpulse HaloImpulse is offline
 
Join Date: Jul 2004
Posts: 48
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

yes i did. I fixed it. But ive come accross a new problem. If a image is thats on the same server is posted on the forums, it says its a broken link. For example, my site: haloimpulse.com

my sig is http://haloimpulse.com/aerotest/aerosig.jpg

however, it says its broken on the forums. But when i host it on my other server, it works fine (http://asylum-designs.com/aero/aerosig.jpg)
Reply With Quote
  #61  
Old 09-18-2004, 05:12 AM
Steve St.Lauren Steve St.Lauren is offline
 
Join Date: May 2002
Posts: 105
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by HaloImpulse
yes i did. I fixed it. But ive come accross a new problem. If a image is thats on the same server is posted on the forums, it says its a broken link. For example, my site: haloimpulse.com

my sig is http://haloimpulse.com/aerotest/aerosig.jpg

however, it says its broken on the forums. But when i host it on my other server, it works fine (http://asylum-designs.com/aero/aerosig.jpg)
My guess would be that it has something to do with a firewall setting on that server. On the site I run users link to pictures on that server all the time and they work no problem. Try this - replace these lines:

// Image not found
$bbtag='<table border="1" cellpadding="2" id="image_found"><tr><td><FONT color="#FF0000">Image link is broken</font></td></tr></table>';
$image_found=false;

with

// Image not found
$bbtag='<table border="1" cellpadding="2" id="image_found"><tr><td><FONT color="#FF0000">'. $link .'</font></td></tr></table>';
$image_found=false;

and these lines:

// Image not found
return '<table border="1" cellpadding="2"><tr><td><FONT color="#FF0000">Image link is broken</font></td></tr></table>';

with:

// Image not found
return '<table border="1" cellpadding="2"><tr><td><FONT color="#FF0000">'. $link .'</font></td></tr></table>';

That will display the link it's trying to go instead of the "broken link" message. Report back with what that says (in case it's different than http://haloimpulse.com/aerotest/aerosig.jpg ).
Reply With Quote
Reply


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. The time now is 04:33 AM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.04496 seconds
  • Memory Usage 2,312KB
  • Queries Executed 25 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (2)bbcode_code
  • (3)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)modsystem_post
  • (1)navbar
  • (6)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (4)pagenav_pagelink
  • (1)pagenav_pagelinkrel
  • (11)post_thanks_box
  • (11)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (11)post_thanks_postbit_info
  • (10)postbit
  • (11)postbit_onlinestatus
  • (11)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete