Auto Resize images when Quoted
This modification is in the archives.
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; } 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; } 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="" />'; } 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>'; } That should be it. Hopefully it works for you! Download
This modification is archived, downloads are still allowed. |
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 |