Go Back   vb.org Archive > vBulletin Modifications > Archive > vB.org Archives > vBulletin 3.6 > vBulletin 3.6 Add-ons

Reply
 
Thread Tools
Auto Resize images when Quoted Details »»
Auto Resize images when Quoted
Version: 1.00, by rokked rokked is offline
Developer Last Online: Apr 2008 Show Printable Version Email this Page

Category: New Posting Features - Version: 3.6.8 Rating:
Released: 04-25-2007 Last Update: Never Installs: 21
Re-useable Code Code Changes  
No support by the author.

Auto Resize Images when they're Quoted
Test with: 3.6.5

This is a pretty basic add on and also my first add on. If you see anything messed up in the code or something that could be done better, please comment and I'll fix it. I'm relatively new to the add-on scene, so there could be better ways to do this.

What does this mod do?
images that get posted within the QUOTE tag will be resized to a width of 100.
thumbnails will link to the url of the actual image.

Installation:
open includes/class_bbcode.php

find:
Code:
$template = $this->printable ? 'bbcode_quote_printable' : 'bbcode_quote';
eval('$html = "' . fetch_template($template) . '";');
return $html;
	}
replace with:
Code:
$template = $this->printable ? 'bbcode_quote_printable' : 'bbcode_quote';
		eval('$html = "' . fetch_template($template) . '";');
		//### RESIZE IMAGES IN QUOTE TAGS
		if ($this->contains_bbcode_img_tags($html)) 
		{
			$html = preg_replace('#\[img\]\s*(https?://([^<>*"]+|[a-z0-9/\\._\- !]+))\[/img\]#iUe', "\$this->handle_bbcode_timg(str_replace('\\\"', '\"', '\\1'), '')", $html);
		}
		//### RESIZE IMAGES IN QUOTE
               	return $html;
	}
find:
Code:
function handle_bbcode_img_match($link)
	{
		$link = $this->strip_smilies(str_replace('\\"', '"', $link));

		// remove double spaces -- fixes issues with wordwrap
		$link = str_replace('  ', '', $link);

		return '<img src="' .  $link . '" border="0" alt="" />';
	}
underneath that paste the following:
Code:
function handle_bbcode_timg($link)
        {
                $link = $this->strip_smilies(str_replace('\\"', '"', $link));

		// remove double spaces -- fixes issues with wordwrap
		$link = str_replace('  ', '', $link);

		return '<a href="' .  $link . '" target="_blank"><img src="' .  $link . '" border="0" width="100" alt="" /></a>';
	}
Save & Upload.

That should be it. Hopefully it works for you!

Show Your Support

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

Comments
  #2  
Old 04-25-2007, 10:52 PM
Shazz's Avatar
Shazz Shazz is offline
 
Join Date: Jun 2006
Location: Utah
Posts: 4,758
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Nice thought, Creative idea, Ill try it on my test site
Reply With Quote
  #3  
Old 04-26-2007, 04:12 AM
Fungsten's Avatar
Fungsten Fungsten is offline
 
Join Date: Jul 2006
Posts: 1,131
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I'll try it on my test server.
Reply With Quote
  #4  
Old 04-26-2007, 07:41 PM
dope15gd dope15gd is offline
 
Join Date: Jan 2006
Posts: 60
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

working perfectly for me. thanks
Reply With Quote
  #5  
Old 04-27-2007, 02:51 AM
Get Shorty's Avatar
Get Shorty Get Shorty is offline
 
Join Date: Jun 2006
Location: Baton Rouge, LA
Posts: 65
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Works flawlessly... Installed!
Reply With Quote
  #6  
Old 04-29-2007, 08:35 PM
letsjoy's Avatar
letsjoy letsjoy is offline
 
Join Date: Jun 2006
Location: Dhump State
Posts: 197
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Nice one thanks
Reply With Quote
  #7  
Old 04-30-2007, 04:37 AM
Get Shorty's Avatar
Get Shorty Get Shorty is offline
 
Join Date: Jun 2006
Location: Baton Rouge, LA
Posts: 65
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I changed this to resize to 200 pixels...

It would be great if it didn't increase the size of small images.
Reply With Quote
  #8  
Old 05-12-2007, 10:32 PM
hippiesimz hippiesimz is offline
 
Join Date: Oct 2006
Posts: 30
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

works for 3.65
Reply With Quote
  #9  
Old 05-13-2007, 02:03 AM
arco arco is offline
 
Join Date: Apr 2007
Posts: 101
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Get Shorty View Post
It would be great if it didn't increase the size of small images.
I'll second that. Looks kinda silly.
Reply With Quote
  #10  
Old 05-29-2007, 11:44 PM
dope15gd dope15gd is offline
 
Join Date: Jan 2006
Posts: 60
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I have a question regarding this and another hack.

I'm running the Nested Quotes hack and it seems to have killed this hack. I'm not good with the code or I'd fix it myself. Anyway if you feel it's worth your time I'd appreciate it.

thanks

edit// solved my problem. somewhere along the line the file got replaced so I just had to reapply the hack.
Reply With Quote
Reply

Thread Tools

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 07:57 PM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.11327 seconds
  • Memory Usage 2,286KB
  • Queries Executed 23 (?)
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
  • (4)bbcode_code
  • (1)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
  • (1)pagenav_pagelink
  • (10)post_thanks_box
  • (10)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (10)post_thanks_postbit_info
  • (9)postbit
  • (10)postbit_onlinestatus
  • (10)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