Go Back   vb.org Archive > vBulletin Modifications > Archive > vB.org Archives > General > Member Archives
Another BB tag to resized linked images Details »»
Another BB tag to resized linked images
Version: , by cinq cinq is offline
Developer Last Online: Nov 2023 Show Printable Version Email this Page

Version: Unknown Rating:
Released: 12-03-2003 Last Update: Never Installs: 0
 
No support by the author.

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.

Show Your Support

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

Comments
  #2  
Old 12-03-2003, 05:26 AM
cinq's Avatar
cinq cinq is offline
 
Join Date: Oct 2002
Posts: 1,398
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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

PHP Code:
[img2]XX[/img2
Reply With Quote
  #3  
Old 12-30-2003, 11:52 PM
cinq's Avatar
cinq cinq is offline
 
Join Date: Oct 2002
Posts: 1,398
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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
Reply With Quote
  #4  
Old 12-30-2003, 11:55 PM
cinq's Avatar
cinq cinq is offline
 
Join Date: Oct 2002
Posts: 1,398
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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.
Reply With Quote
  #5  
Old 12-31-2003, 07:57 AM
MaDCaT75 MaDCaT75 is offline
 
Join Date: Jul 2003
Location: Southern California
Posts: 718
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

This works great except for people who have image signatures :\
Reply With Quote
  #6  
Old 12-31-2003, 08:26 AM
cinq's Avatar
cinq cinq is offline
 
Join Date: Oct 2002
Posts: 1,398
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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....
Reply With Quote
  #7  
Old 12-31-2003, 04:16 PM
MindTrix's Avatar
MindTrix MindTrix is offline
 
Join Date: Apr 2002
Location: United Kingdom
Posts: 1,833
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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.
Reply With Quote
  #8  
Old 02-04-2004, 04:09 PM
chrisvonc's Avatar
chrisvonc chrisvonc is offline
 
Join Date: Apr 2002
Location: Austin, TX
Posts: 161
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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
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 12:40 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.06888 seconds
  • Memory Usage 2,279KB
  • Queries Executed 21 (?)
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
  • (7)bbcode_php
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)modsystem_post
  • (1)navbar
  • (6)navbar_link
  • (120)option
  • (8)post_thanks_box
  • (8)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (8)post_thanks_postbit_info
  • (7)postbit
  • (8)postbit_onlinestatus
  • (8)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
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete