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
  #52  
Old 04-07-2003, 06:54 PM
Blindchild02's Avatar
Blindchild02 Blindchild02 is offline
 
Join Date: Apr 2002
Location: USA
Posts: 741
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

i think its only jpg's that dont work, cuz gif does :|
Reply With Quote
  #53  
Old 04-08-2003, 03:00 PM
boutwell's Avatar
boutwell boutwell is offline
 
Join Date: Oct 2001
Posts: 12
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I wish I had found this months ago...great hack Z

However, I think the install .txt file may have gotten trunked somehow. This is all I am getting:

PHP Code:
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 thumbnailLarge 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 80x60it will show up as is

This tag is identical to the IMG tag.

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

Check out this link 
for a demo: [url]http://www.ls1.com/forums/showthread.php?s=&threadid=276879[/url]

*************************************************************************************
NoteThis tag does not resize the actual pictureIt just displays them at a smaller
      scale
It will not help with bandwidth preservation.
*************************************************************************************


In admin/functions.php
Look 
for:

        
$bbcode=str_replace("{""{"$bbcode); // stop people posting replacements in their posts

  
return censortext($bbcode);

And 
change it to:

        
$bbcode=str_replace("{""{"$bbcode); // stop people posting replacements in their posts
        
$bbcode=preg_replace("/\[thumb\](\r\n|\r|\n)*((http|https):\/\/([^;<>\(\)\"".iif($allowdynimg,"","!\*\?\&")."]+)|[a-z0-9\/\\\._\- ]+)\[\/thumb\]/esiU""dothumb('\\2')"$bbcode);
  return 
censortext($bbcode);

########################################

In admin/functions.php

look 
for:

// ###################### Start phphighlite #######################

Add the following directly above it:

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

  
$img_info = @getimagesize($code);
  if(
$img_info[0]) {
    if((
$img_info[0] <= 80) and ($img_info[1] <= 60)) {
      
$code "<a href=\"$code\" target=\"_blank\"><img src=\"$code\"></a>";
    }
    else {
      
$xratio $img_info[0] / 80;
      
$yratio $img_info[1] / 60;
      
$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=\"3\"></a>";
    }
  }

  return(
$code);

I did this and the tag isn't working...don't I have to add a BBcode via the admin control panel as well?
Reply With Quote
  #54  
Old 04-08-2003, 05:11 PM
Zzed's Avatar
Zzed Zzed is offline
 
Join Date: Feb 2002
Location: Glendale, CA, USA
Posts: 463
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

It is the complete file. That's all you need to do. No need to add anything through the admin CP.
Reply With Quote
  #55  
Old 04-08-2003, 05:41 PM
boutwell's Avatar
boutwell boutwell is offline
 
Join Date: Oct 2001
Posts: 12
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Ok I am at a total loss here Zzed...are there any other hacks that this doesn't cooperate with with perhaps? Everything is set correctly but it still only shows the URL of the image I post for some reason.

Here is my test post:

http://dev.ringofdestiny.com/vb/show...php?threadid=2

Here is the contents of that post:

{thumb}http://205.214.94.176/~rod/images/emperor.jpg{/thumb} (with brackets of course)

If you are really bored I will mail you the info for my dev board and you can take a look
Reply With Quote
  #56  
Old 04-08-2003, 05:57 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 11:41 AM boutwell said this in Post #54
Ok I am at a total loss here Zzed...are there any other hacks that this doesn't cooperate with with perhaps? Everything is set correctly but it still only shows the URL of the image I post for some reason.

Here is my test post:

http://dev.ringofdestiny.com/vb/show...php?threadid=2

Here is the contents of that post:

{thumb}http://205.214.94.176/~rod/images/emperor.jpg{/thumb} (with brackets of course)

If you are really bored I will mail you the info for my dev board and you can take a look
Sure. Hit me...

My Email is: edwink@seebeyond.com
Reply With Quote
  #57  
Old 04-08-2003, 06:18 PM
boutwell's Avatar
boutwell boutwell is offline
 
Join Date: Oct 2001
Posts: 12
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Info is on its way Zzed. Thanks bud
Reply With Quote
  #58  
Old 04-08-2003, 06:58 PM
Zzed's Avatar
Zzed Zzed is offline
 
Join Date: Feb 2002
Location: Glendale, CA, USA
Posts: 463
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Everything is working fine.
Reply With Quote
  #59  
Old 04-08-2003, 07:52 PM
Blindchild02's Avatar
Blindchild02 Blindchild02 is offline
 
Join Date: Apr 2002
Location: USA
Posts: 741
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

.jpg's dont work for me either :'(

zzed do u have AIM or MSN??
Reply With Quote
  #60  
Old 04-08-2003, 08:20 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 01:52 PM Blindchild02 said this in Post #58
.jpg's dont work for me either :'(

zzed do u have AIM or MSN??
I worked with boutwell and we dicovered that his site is not able to get the length and width dimensions for certain pictures.

The dothumb() function tries to obtain the XY sizes for the picture and if it is not able to do it, it displays the URL for the picture...

This is how you can debug your code:

In functions.php

Look for:
PHP Code:
  $img_info = @getimagesize($code); 
And replace it with the following:
PHP Code:
  $img_info = @getimagesize($code);
  echo 
"$code <br>";
  echo 
"$img_info[0] <br>";
  echo 
"$img_info[1] <br>"
And you will notice that the length and width information show up blank.

If you want to bypass all the drama you can go the easy route and replace the function dothumb() with the following:
PHP Code:
 
function dothumb($code) {
 
  
$code="<a href=\"$code\" target=\"_blank\"><img src=\"$code\" width=\"80\" height=\"60\" border=\"3\"></a>";
 
  return(
$code);

Of course the only drawback with this is that if you try and thumbnail a smilie, it will actually magnify it.

Let me know if this helps...
Reply With Quote
  #61  
Old 04-08-2003, 08:21 PM
Blindchild02's Avatar
Blindchild02 Blindchild02 is offline
 
Join Date: Apr 2002
Location: USA
Posts: 741
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

well i woudl like to talk on AIM or msn plz

aim - bc aka blind
msn - starman_02@msn.com
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 11:17 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.10232 seconds
  • Memory Usage 2,344KB
  • Queries Executed 25 (?)
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
  • (4)bbcode_php
  • (2)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_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