Back to vBulletin 3.6 Add-ons

Auto Resize images when Quoted
Mod Version: 1.00, by rokked

This modification is in the archives.
vB Version: 3.6.8 Rating: (2 votes - 5.00 average) Installs: 21
Released: 26 Apr 2007 Last Update: Never Downloads: 118
Not Supported Code Changes Re-usable Code  

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!

Download

This modification is archived, downloads are still allowed.

File Type: %1$s Auto Resize Images in QUOTE tag.txt (1.9 KB, 119 downloads)

Similar Mods

Show Thread Enhancements Auto Resize large images in an IMG tag vBulletin 3.7 Add-ons
Forum Display Enhancements Auto Resize large images in an IMG tag vBulletin 3.6 Add-ons
auto resize huge images vBulletin 3.0 Template Modifications
Auto Resize Your Images 3.52 compliant vBulletin 3.5 Add-ons

vblts.ru supports vBulletin®, 2022-2024