vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   Member Archives (https://vborg.vbsupport.ru/forumdisplay.php?f=202)
-   -   Restrict image size, Don't stretch tables! (https://vborg.vbsupport.ru/showthread.php?t=49353)

Nomb 02-25-2003 05:17 PM

Restrict image size, Don't stretch tables!
 
Many attempts have been made at creating a hack like this and I've tried them all and none of them just resize the image onlyif if it's over a certain size.

I thought I'd use the getimagesize function to accomplish this. I don't want any images with a width of over 550 pixels showing in my postbits. Well, I want to show them, but I want them resized proportionately with a width of 550. Here's what I've done in functions.php and I'm getting a parse error:

PHP Code:

        if($dobbimagecode and ($bbuserinfo[userid]==or $bbuserinfo[showimages])) {
      
// do [img.]xxx[/img.]
      
$imginforesize=@getimagesize(\\2);
      if(
$imginforesize[0]>550) {
      
$height "height=\"((550 / $imginforesize[0]) * $imginforesize[1])\"";
      
$bbcode preg_replace("/\[img\](\r\n|\r|\n)*((http|https):\/\/([^;<>\(\)\"".iif($allowdynimg,"","!\*\?\&")."]+)|[a-z0-9\/\\\._\- ]+)\[\/img\]/siU""<img src=\"\\2\" border=\"0\" alt=\"\" width=\"550\" $height>"$bbcode);
      } else {
      
$bbcode preg_replace("/\[img\](\r\n|\r|\n)*((http|https):\/\/([^;<>\(\)\"".iif($allowdynimg,"","!\*\?\&")."]+)|[a-z0-9\/\\\._\- ]+)\[\/img\]/siU""<img src=\"\\2\" border=\"0\" alt=\"\">"$bbcode);
    }
    
$bbcode preg_replace("/\[img\](\r\n|\r|\n)*((http|https):\/\/([^;<>\*\(\)\"]+)|[a-z0-9\/\\\._\- ]+)\[\/img\]/siU""<a href=\"\\2\" target=\"_blank\">\\2</a>"$bbcode);

    
$bbcode=str_replace("\\'""'"$bbcode); 

Anyone see my mistake here?

Erwin 02-25-2003 10:37 PM

Are you missing } right at the bottom to close the first if { ?

Freddie Bingham 02-25-2003 10:59 PM

Do you realize how much you are going to slow your forum down if you call getimagesize on remote images? Not to mention the bandwidth involved in transferring images for every view of showthread.

colicab-d 02-25-2003 11:45 PM

id love to see this but i think overgrow has a great version of this working for them


All times are GMT. The time now is 09:44 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.01711 seconds
  • Memory Usage 1,723KB
  • 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
  • (1)bbcode_php_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (4)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