vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 3.6 Add-ons (https://vborg.vbsupport.ru/forumdisplay.php?f=194)
-   -   New Posting Features - Auto Resize images when Quoted (https://vborg.vbsupport.ru/showthread.php?t=145766)

rokked 04-25-2007 10:00 PM

Auto Resize images when Quoted
 
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!

Shazz 04-25-2007 10:52 PM

Nice thought, Creative idea, Ill try it on my test site :)

Fungsten 04-26-2007 04:12 AM

I'll try it on my test server.

dope15gd 04-26-2007 07:41 PM

working perfectly for me. thanks

Get Shorty 04-27-2007 02:51 AM

Works flawlessly... Installed!

letsjoy 04-29-2007 08:35 PM

Nice one thanks :)

Get Shorty 04-30-2007 04:37 AM

I changed this to resize to 200 pixels...

It would be great if it didn't increase the size of small images.

hippiesimz 05-12-2007 10:32 PM

works for 3.65

arco 05-13-2007 02:03 AM

Quote:

Originally Posted by Get Shorty (Post 1238013)
It would be great if it didn't increase the size of small images.

I'll second that. Looks kinda silly. :)

dope15gd 05-29-2007 11:44 PM

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.


All times are GMT. The time now is 07:02 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.01096 seconds
  • Memory Usage 1,737KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (4)bbcode_code_printable
  • (1)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (10)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.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/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.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
  • printthread_start
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete