vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 3.0 Full Releases (https://vborg.vbsupport.ru/forumdisplay.php?f=33)
-   -   Wide image automatic resize for html and vB tags in posts - fixes template problems (https://vborg.vbsupport.ru/showthread.php?t=67743)

Steve St.Lauren 08-02-2004 06:32 PM

It looks like cinq's image problem is a bug in the version of php he's running. I linked to the same images on our site and they worked fine. We are running php v4.2.1 . Not sure yet what he's running.

Jolten 08-03-2004 11:37 PM

I'm running PHP 4.2.3 and it only works on some images, not all of them.

Like here this thread

But it did work on an image in this thread

Steve St.Lauren 08-04-2004 01:58 AM

Jolten - That picture is an attachment, it's not using vB IMG or html IMG SRC tags. You can limit the size of attachments through the vbulletin setting in your admin control panel. This hack deals with images that are linked from other servers via tags.

Jolten 08-04-2004 02:01 AM

ahh. okay.. Sorry My bad. So the reduce image only works for directly linked images. Great! Thanks Steve.

vau7 08-04-2004 04:59 AM

Okay, its really finde , i installed it.
I would like to do a change: How can i change it to target=_blank?

Thank you.

Steve St.Lauren 08-04-2004 12:17 PM

You would add it into these lines:

in the first part:

$bbtag = '<table><tr><td align="center"><a href="' . $link . '"><img src="' . $link . '" width="'.$max_imgsize.'" border="0"'.substr($bbtag,$linkclose+1,strlen($bbt ag)-$linkclose+1).'<br>Picture has been resized, click for full size pic</a></td></tr></table>';

would become:

$bbtag = '<table><tr><td align="center"><a href="' . $link . '" target="_blank"><img src="' . $link . '" width="'.$max_imgsize.'" border="0"'.substr($bbtag,$linkclose+1,strlen($bbt ag)-$linkclose+1).'<br>Picture has been resized, click for full size pic</a></td></tr></table>';

and in the second section:

$biglink = '<table><tr><td align="center"><a href="' . $link . '" ><img src="' . $link . '" width="'.$max_imgsize.'" border="0" alt=""><br>Picture has been resized, click for full size pic</a></td></tr></table>';

would become:

$biglink = '<table><tr><td align="center"><a href="' . $link . '" target="_blank"><img src="' . $link . '" width="'.$max_imgsize.'" border="0" alt=""><br>Picture has been resized, click for full size pic</a></td></tr></table>';

vau7 08-04-2004 04:33 PM

Thank you very much. Done.

EricR 08-10-2004 12:53 AM

Excellent, I only had one snag. I had to add
Code:

$max_imgsize=560;
to the second part as well, otherwise it was setting my width to zero. Adding that to the second section fixed it for me. Thanks Steve!

Snatch 08-10-2004 04:58 AM

I hve somme Error

Fatal error: Call to undefined function: handle_bbcode_img_match() in /var/www/web1/html/vb3/includes/functions_bbcodeparse.php(1085) : regexp code on line 1


do i have the comlete Line
Code:

function handle_bbcode_img_match($link)
{
        $link = strip_smilies(str_replace('\\"', '"', $link));

        // remove double spaces -- fixes issues with wordwrap
        $link = str_replace('  ', '', $link);

and replace ist with
Code:

        // Image Size hack r1.0
        // Modified by SS to resize large pics and place link to full size pic
        // return '<img src="' .  $link . '" border="0" alt="" />';

        global $max_imgsize;
               
        $image= ($link);

        // Get host url name for fsockopen to see if server is reachable
        $img_host=str_replace('http://','',$link);
        $img_host=substr($img_host,0,strpos($img_host,'/'));

        // Check is server is reachable and timeout in 5 seconds if not
        if (@fclose(@fsockopen($img_host, 80, $fsockerr1, $fsockerr2, 5))) {
                // Check if image is on server
                if (@fclose(@fopen("$image", "r"))) {
                        // Check image size and if oversize, change link
                        $img_width = getimagesize($link);
                        if ($img_width[0] > $max_imgsize) {
                                $biglink = '<table><tr><td align="center"><a href="' . $link . '" ><img src="'
                                        . $link . '" width="'.$max_imgsize.'" border="0" alt=""><br>Picture has been resized, click for full size pic</a></td></tr></table>';
                                return $biglink;
                                }
                        else {
                                return '<img src="' .  $link . '" border="0" alt="" />';
                                }
                        }
                else {
                        // Image not found
                        return '<table border="1" cellpadding="2"><tr><td><FONT color="#FF0000">Image link is broken</font></td></tr></table>';
                        }
                }
        else {
                // Server is down
                return '<table border="1" cellpadding="2"><tr><td><FONT color="#FF0000">Image server is down</font></td></tr></table>';
                }

        // End Image Size hack r1.0

If I do this i become this error

Steve St.Lauren 08-10-2004 05:42 AM

Only replace the return line with that code - not all the lines you've shown. It is the very next line after those that you are replacing. I have that line commented out in the beginning of the hack so that you can roll back to it if you want to down the road. This is the line:

return '<img src="' . $link . '" border="0" alt="" />';

I've just updated this, btw - please use the new code. I only changed 3 lines due to problem a couple people had.


All times are GMT. The time now is 11:36 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.01122 seconds
  • Memory Usage 1,751KB
  • 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
  • (3)bbcode_code_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (4)pagenav_pagelink
  • (1)pagenav_pagelinkrel
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (10)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
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete