vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   Member Archives (https://vborg.vbsupport.ru/forumdisplay.php?f=202)
-   -   Another BB tag to resized linked images (https://vborg.vbsupport.ru/showthread.php?t=58969)

cinq 12-03-2003 05:24 AM

Another BB tag to resized linked images
 
Not a hack as no editting of PHP files are involved, though I'd like to share it.

What it does ?

When users link images, at times the images linked are a tad too big for your forum layout and spoils the look of the page.

This new bb code, provided the images are linked using this BB code, will allow smaller thumbnails to retain the layout of the page.

The image is not resized per se, it is just viewed as resized so that it would not spoil the page layout.

-------------------------------------------------------

Steps to perform
Add a new BB code ( AdminCP -> Custom vB Codes -> Add

vB Code tag
PHP Code:

img2 

vB Code replacement
PHP Code:

<img src={paramborder='2' onload="javascript:if(this.width>screen.width-600){ this.height=Math.round(((screen.width-600)/this.width)*this.height); this.width=(screen.width-600);}" onclick="javascript:window.open('{param}','','scrollbars=1')"/>
<
br><smallfont>&nbsp;* Image resizedClick on image to view full size.</smallfont><br

vB Code example
PHP Code:

[img2]http://www.yoursite.com/forum/images/banner.jpg[/img2] 

Use {option} ?
Select No.
-------------------------------------------------------

Notes:
Thumbnail sizing is proportionate. It can be changed by altering the value 600 in the code replacement bit.
-------------------------------------------------------

Hope this proves useful. :)

cinq 12-03-2003 05:26 AM

Once done, to use this , simply put the image to be linked btw the following tags :

PHP Code:

[img2]XX[/img2


cinq 12-30-2003 11:52 PM

Sorry , just an update on this :
I have found that you need to do an SQL Query first for this to work without errors ( without doing this step , I encountered errors in the admincp when adding the code replacement )


Run the following query:
PHP Code:

ALTER TABLE bbcode CHANGE bbcodereplacement bbcodereplacement LONGTEXT NOT NULL


cinq 12-30-2003 11:55 PM

And while checking around for how to make current linked images ( ie those using [ img] tags ) similiarly resized, chanced upon some code provided by Zzed in one of his hacks (here) which can be used here as well.


In admin/functions.php:
Look for:

PHP Code:

function bbcodeparse2($bbcode,$dohtml,$dobbimagecode,$dosmilies,$dobbcode
// parses text for vB code, smilies and censoring 

  
global $DB_site,$wordwrap,$allowdynimg$bbuserinfo

  static 
$smilies,$bbcodes
  global 
$regexcreated,$searcharray,$replacearray,$phpversionnum

Add below:
PHP Code:

$bbcode =  preg_replace("/img\]/i""img2]"$bbcode); 

This will replace all linked images using the [ img] tags with the new [ img2] tag automatically.

MaDCaT75 12-31-2003 07:57 AM

This works great except for people who have image signatures :\

cinq 12-31-2003 08:26 AM

That's something that I have not found a work around yet however as ALL img tags will be amended to use img2 :(
However if the images in their sigs are that big that they must be resized.... woah.... :D

MindTrix 12-31-2003 04:16 PM

im pretty sure there is a mod at www.vbulletintemplates.com which re-sizes signature images. I think it worked that if they had an image over the limit, it cut the image too the proper size.

chrisvonc 02-04-2004 04:09 PM

I tried this on 2 test platforms (vB 2.3.2) and I cant get it to resize the pictures at all no matter what numeric value I put in. Any ideas?

Thanks!

Chris


All times are GMT. The time now is 01:03 PM.

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.01059 seconds
  • Memory Usage 1,739KB
  • 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
  • (7)bbcode_php_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (8)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
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete