Go Back   vb.org Archive > vBulletin Modifications > Archive > vB.org Archives > vBulletin 2.x > vBulletin 2.x Full Releases
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools
New BB tag to do image thumbnails... Details »»
New BB tag to do image thumbnails...
Version: 1.00, by Zzed Zzed is offline
Developer Last Online: Feb 2012 Show Printable Version Email this Page

Version: 2.2.x Rating:
Released: 03-26-2003 Last Update: Never Installs: 30
 
No support by the author.

This hack adds a new tag to your forums that will allow you to post images
in the form of a thumbnail.

The tag allows you to post pictures in the form of a thumbnail. Large images
can throw off the page, and the tag will scale the picture down to an 80x60
thumbnail preserving its original length and width ratio and turn it into a
hyperlink that you can click on and see the full image in a new browser window.
If the image being thumbnailed is smaller than 80x60, it will show up as is.

This tag is identical to the IMG tag. The new tag is THUMB

Tables affected: none
Templates affected: none
Files affected: admin/functions.php

Check out this link for a demo: http://www.ls1.com/forums/showthread...hreadid=276879

Note: This tag does not resize the actual picture. It just displays them at a smaller
scale. It will not help with bandwidth preservation.

Show Your Support

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

Comments
  #72  
Old 04-11-2003, 09:16 PM
Zzed's Avatar
Zzed Zzed is offline
 
Join Date: Feb 2002
Location: Glendale, CA, USA
Posts: 463
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Today at 03:05 PM Katman said this in Post #70
I don't know what it was but I tried it again and now it's working! Thank You! You are the master!

Now the only problem I can see is the images in the signatures, they're linked now, with a border, even after I changed border=1 to 0.
Thank you kind sir.

Please give me a link to a thread containing an image in the sig.

And I am so hurt that you deleted my replies... :laugh::banana:
Reply With Quote
  #73  
Old 04-11-2003, 09:18 PM
Katman's Avatar
Katman Katman is offline
 
Join Date: Oct 2002
Location: New Glarus, WI
Posts: 55
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

<a href="http://www.tlplanet.com/forums/showthread.php?threadid=2006" target="_blank">http://www.tlplanet.com/forums/showt...?threadid=2006</a>

Sorry about that, just part of the testing process
Reply With Quote
  #74  
Old 04-11-2003, 09:25 PM
Zzed's Avatar
Zzed Zzed is offline
 
Join Date: Feb 2002
Location: Glendale, CA, USA
Posts: 463
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

That's because the image is 256x170 which is smaller than your 320x240 image resize.

in dothumb()

Replace this:
Code:
    if(($img_info[0] <= 80) and ($img_info[1] <= 60)) {
      $code = "<a href=\"$code\" target=\"_blank\"><img src=\"$code\"></a>";
    }
with this:
Code:
    if(($img_info[0] <= 80) and ($img_info[1] <= 60)) {
      $code = "<a href=\"$code\" target=\"_blank\" border=\"0\"><img src=\"$code\"></a>";
    }
Excpet that instead of 80 and 60 you would be using 320 and 240 in the if statement.
Reply With Quote
  #75  
Old 04-11-2003, 09:30 PM
Katman's Avatar
Katman Katman is offline
 
Join Date: Oct 2002
Location: New Glarus, WI
Posts: 55
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I did that originally.

Forget it, I see, Duh, you added the border=0

Code:
// ###################### Start dothumb #######################
function dothumb($code) {

  $img_info = @getimagesize($code);
  if($img_info[0]) {
    if(($img_info[0] <= 320) and ($img_info[1] <= 240)) {
      $code = "<a href=\"$code\" target=\"_blank\"><img src=\"$code\"></a>";
    }
    else {
      $xratio = $img_info[0] / 320;
      $yratio = $img_info[1] / 240;
      $factor = $xratio;
      if($yratio > $xratio) {
        $factor = $yratio;
      }
      $xsize = intval($img_info[0] / $factor);
      $ysize = intval($img_info[1] / $factor);
      $code="<a href=\"$code\" target=\"_blank\"><img src=\"$code\" width=\"$xsize\" height=\"$ysize\" border=\"0\"></a><br><font size=\"-2\">(click for larger image)</font>";
    }
  }

  return($code);
}
// ###################### End dothumb #######################
Reply With Quote
  #76  
Old 04-11-2003, 09:34 PM
Zzed's Avatar
Zzed Zzed is offline
 
Join Date: Feb 2002
Location: Glendale, CA, USA
Posts: 463
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Cool.
Reply With Quote
  #77  
Old 04-11-2003, 09:35 PM
Katman's Avatar
Katman Katman is offline
 
Join Date: Oct 2002
Location: New Glarus, WI
Posts: 55
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Nope, still linked with border. I'm going to add border=\"0\" to every href tag!

Damn, still there.

Got it! Needed to add border=0 to
Code:
<img src=\"$code\" border=\"0\"></a>";
Reply With Quote
  #78  
Old 04-11-2003, 09:39 PM
Zzed's Avatar
Zzed Zzed is offline
 
Join Date: Feb 2002
Location: Glendale, CA, USA
Posts: 463
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Today at 03:29 PM Katman said this in Post #76
Nope, still linked with border. I'm going to add border=\"0\" to every href tag!

Nope, just hit reload. The border will go away.
Reply With Quote
  #79  
Old 04-11-2003, 09:40 PM
Katman's Avatar
Katman Katman is offline
 
Join Date: Oct 2002
Location: New Glarus, WI
Posts: 55
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

OK, I'm done now, it's all good! Thanks for the quick helpful replies!
Reply With Quote
  #80  
Old 04-11-2003, 09:47 PM
Zzed's Avatar
Zzed Zzed is offline
 
Join Date: Feb 2002
Location: Glendale, CA, USA
Posts: 463
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

You're very welcome.
Reply With Quote
  #81  
Old 04-11-2003, 09:59 PM
Larry@IOG Larry@IOG is offline
 
Join Date: May 2002
Posts: 95
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Today at 05:57 PM Zzed said this in Post #69
Hmm, I don't know why the PHP tag mutilated my preg_replace statement.

I have tried this on my board and it worked just fine.

Code:
$bbcode =  preg_replace("/img\]/i", "thumb]", $bbcode);
Didnt work for me, showed the image as a link rather than a thumbnail


Larry
Reply With Quote
Reply


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 07:04 AM.


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.06512 seconds
  • Memory Usage 2,314KB
  • Queries Executed 27 (?)
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
  • (5)bbcode_code
  • (3)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)modsystem_post
  • (1)navbar
  • (6)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (4)pagenav_pagelink
  • (11)post_thanks_box
  • (11)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (11)post_thanks_postbit_info
  • (10)postbit
  • (11)postbit_onlinestatus
  • (11)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_postinfo_query
  • fetch_postinfo
  • 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
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete