View Single Post
  #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
 
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01307 seconds
  • Memory Usage 1,809KB
  • Queries Executed 11 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD_SHOWPOST
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)bbcode_php
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_box
  • (1)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (1)post_thanks_postbit_info
  • (1)postbit
  • (1)postbit_onlinestatus
  • (1)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • reputationlevel
  • showthread
Included Files:
  • ./showpost.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
  • showpost_start
  • bbcode_fetch_tags
  • bbcode_create
  • postbit_factory
  • showpost_post
  • 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
  • showpost_complete