vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 3.5 Add-ons (https://vborg.vbsupport.ru/forumdisplay.php?f=113)
-   -   Auto Resize Your Images 3.52 compliant (https://vborg.vbsupport.ru/showthread.php?t=103915)

ggiersdorf 01-26-2006 11:07 PM

Thanks Stangsta, I think there is another location also which is causing me an issue, mabey it's the code im using but it will take a few days and I will be back..

Cross you fingers.. :)

Snake 01-26-2006 11:33 PM

Screenshot please?

S@NL - BlackBik 01-27-2006 12:00 AM

Screenshot for what?

Snake 01-27-2006 12:03 AM

Nevermind.

Alex_ 01-28-2006 07:43 AM

I have threads with lot's of images - when I use the version with getimagesize it takes a very very long time to open the thread - but when I comment out the size check every image is turned into a link even when it already was one.
This leads to the effect that clicking on an imageshack.us thumbnail you don't open the fullsize version but the thumbnail opens in another page... :(

ggiersdorf 01-28-2006 12:14 PM

Images have to "pre-load" I have the same issues with posts with like 27 images in it. I have set mine now to anything over 500px gets scaled down to 150 allowing 3 to 4 images per line on my forum this way signatures can be upto 500 pxs without having them resized also...

PJSkiboy 01-30-2006 02:25 AM

I'm watching this thread for the update. Sounds promising ggiersdorf. Thank you very much for all the effort.

Zia 01-31-2006 05:16 AM

Quote:

Originally Posted by ggiersdorf
Thanks Stangsta, I think there is another location also which is causing me an issue, mabey it's the code im using but it will take a few days and I will be back..

Cross you fingers.. :)

:banana: :banana: man......cant wait more to have that one

lazytown 01-31-2006 07:36 AM

S@NL - BlackBik,

I had some errors on my forum with the resizing (at least I believe that's what caused it). I had a previous version of VBGallery installed. I then upgraded to VBPicGallery. So the old vbgallery pictures are now broken if posted within the forum (they are broken regardless of your mod)

Using the mod you provided, I get the following error at the very top of the forum page for certain threads.
Quote:

Warning: getimagesize(http://www.myforumdomain/.com/forum/...100%26id=135): could not make seekable - http://www.myforumdomain.com/forum/v...h=100%26id=135 in /includes/class_bbcode.php on line 1852
-vissa

lazytown 01-31-2006 07:57 AM

So am I correct in saying that this mod is server-side? In other words, the server actually has to download the image from wherever it is linked to before it does anything with it? Couldn't the whole thing be implemented client-side with javascript? That way the user's computer is doing the work and not the forum server.

-vissa

ggiersdorf 01-31-2006 02:43 PM

The problem I am running into now is basically Signatures are used with the IMG tag this mod changes anything that has the IMG tag.

We need to re-write the $signature to use an alternate img tag like [SIG] [SIG] or somehow have the field for signatures remove the script above and use the default one from Vb. Basically trick it in signatures to use original vb code.

PHP Code:

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

anyone want to help with this let me know I have some updated code than the above that works better but Im holding off posting it till were done here..

S@NL - BlackBik 01-31-2006 06:42 PM

Quote:

Originally Posted by vissa
S@NL - BlackBik,

I had some errors on my forum with the resizing (at least I believe that's what caused it). I had a previous version of VBGallery installed. I then upgraded to VBPicGallery. So the old vbgallery pictures are now broken if posted within the forum (they are broken regardless of your mod)

Using the mod you provided, I get the following error at the very top of the forum page for certain threads.


-vissa

Hi Vissa,

Sorry, but I can't help you there. The error is caused by vbgarage.php and I don't use that hack. I don't have a clue why you get this error.

Yes you are right when you say my version of this hack is on the serverside. It causes extra serverload and when you have many images in a thread (including sig images) it will definitly slow your page.
There is a java hack on the cli?nt side. I'm using it now, since my users complained about long loading times. You can find it here: https://vborg.vbsupport.ru/showthrea...ghlight=resize.
It's not as sophisticated, it doesn't show when an image is unavailable or the imageserver is down, but it's much quicker ;)

ggiersdorf's hack is also on the serverside, but it's much quicker as my version as it execute less code and doesnt get the imagesize before resizing the image.

3dsoft 01-31-2006 07:57 PM

The image resizes correctly but the layout is still broken in Opera 8.51

What are the template changes?

lazytown 02-01-2006 11:16 AM

Thanks for your help -- I will look at the javascript version.

-vissa

Zia 02-02-2006 06:53 PM

ggiersdorf

Quote:

Where the signature variable is. Which I think it's $post[signature]
https://vborg.vbsupport.ru/showthread.php?t=92625
this variable was posted in that link...

dont know, mite it give some support

The_Rayman 02-10-2006 02:05 PM

Hey S@NL - BlackBiker,

Thanks for the advanced hack!
Got it installed and works fine here in Mozilla and IE... don't use Opera... ;)

kompakt 02-23-2006 11:35 PM

works perfectly for me, thanks :)

Zia 03-02-2006 04:59 PM

ggiersdorf ..helo..
umm when update will be release?

kildjean 03-03-2006 08:35 PM

I modified the info with the text you suggested and I got this error now:

Parse error: parse error, unexpected T_IF, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in /home/zonaxbox/public_html/foros/includes/class_bbcode.php on line 1978

rhino56 03-05-2006 03:23 PM

i used it and it worked fine, version 3.53

www.cryo-labs.com

Blown Beauty 03-08-2006 01:51 AM

Quote:

Originally Posted by Puntoboy
so if i use your code i won't have a problem?

Code:

        /* Start hack Image RESIZE */ 

                // Check to see if image exists
                $link = str_replace(" " , "%20", $link);
                $link = str_replace("&amp;" , "%26", $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("$link", "rb"))) {
                                // Check image size and if oversize, change bbtag
                                $img_width = getimagesize($link);
                                if ($img_width[0] > 600) {
                                        $navigator_user_agent = ( isset( $_SERVER['HTTP_USER_AGENT'] ) ) ? strtolower( $_SERVER['HTTP_USER_AGENT'] ) : ''; 
                                        if (stristr($navigator_user_agent, "msie")) { 
                                            return '<a href="' .  $link . '" target="_blank"><img src="' .  $link . '" border="0" alt="' . $vbphrase['click_for_larger_image'] . '" style="width: expression(this.width > 600 ? 600 : true);" /></a>'; 
                                        } else { 
                                            return '<a href="' .  $link . '" target="_blank"><img src="' .  $link . '" border="0" alt="' . $vbphrase['click_for_larger_image'] . '" style="max-width: 600px;" /></a>'; 
                                        }
                                } else {
                                        return '<img src="' .  $link . '" border="0" alt="" />';
                                }
                        } else {
                                // Image not found
                                return '<table border="1" cellpadding="2" id="image_found"><tr><td><FONT color="#FF0000">' . $vbphrase['image_link_broken'] . '</font></td></tr></table>';
                        }
                } else {
                        // Server is down
                        return '<table border="1" cellpadding="2" id="image_found"><tr><td><FONT color="#FF0000">' . $vbphrase['image_server_down'] . '</font></td></tr></table>';
                }
               
        /* End hack Image RESIZE */


Worked perfectly! Thanks! :)

Zia 03-11-2006 02:20 PM

hello....
:) when we can accept an updated that wont touch sigs ?

and re-size works with IE,opera,firefox

MotMann 03-14-2006 04:38 PM

Quote:

Originally Posted by S@NL - BlackBik
OK guys,

Here is the last revision of my code. Finaly got it working:
Code:

        /* Start hack Image RESIZE */ 

                // Check to see if image exists
                $link = str_replace(" " , "%20", $link);
                $link = str_replace("&amp;" , "%26", $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("$link", "rb"))) {
                                // Check image size and if oversize, change bbtag
                                $img_width = getimagesize($link);
                                if ($img_width[0] > 600) {
                                        $navigator_user_agent = ( isset( $_SERVER['HTTP_USER_AGENT'] ) ) ? strtolower( $_SERVER['HTTP_USER_AGENT'] ) : ''; 
                                        if (stristr($navigator_user_agent, "msie")) { 
                                            return '<a href="' .  $link . '" target="_blank"><img src="' .  $link . '" border="0" alt="' . $vbphrase['click_for_larger_image'] . '" style="width: expression(this.width > 600 ? 600 : true);" /></a>'; 
                                        } else { 
                                            return '<a href="' .  $link . '" target="_blank"><img src="' .  $link . '" border="0" alt="' . $vbphrase['click_for_larger_image'] . '" style="max-width: 600px;" /></a>'; 
                                        }
                                } else {
                                        return '<img src="' .  $link . '" border="0" alt="" />';
                                }
                        } else {
                                // Image not found
                                return '<table border="1" cellpadding="2" id="image_found"><tr><td><FONT color="#FF0000">' . $vbphrase['image_link_broken'] . '</font></td></tr></table>';
                        }
                } else {
                        // Server is down
                        return '<table border="1" cellpadding="2" id="image_found"><tr><td><FONT color="#FF0000">' . $vbphrase['image_server_down'] . '</font></td></tr></table>';
                }
               
        /* End hack Image RESIZE */
//        /* Original code:                return '<img src="' .  $link . '" border="0" alt="" />'; */

If you are gonna use this, be sure to add the three phrases.

What you mean? witch phrases?

And i have the problem, that the screens not in the same width and height... not in proportion. there are to high.

What shel i do?

drewclark 03-26-2006 08:11 PM

Quote:

Originally Posted by kildjean
I modified the info with the text you suggested and I got this error now:


Parse error: parse error, unexpected T_IF, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in /home/zonaxbox/public_html/foros/includes/class_bbcode.php on line 1978

I'm getting the same error...

chanthuyen 05-13-2006 02:00 PM

Quote:

Originally Posted by 3dsoft
The image resizes correctly but the layout is still broken in Opera 8.51

What are the template changes?

Try this : https://vborg.vbsupport.ru/showthread.php?t=115277

( Down load imageresize mod.zip)

SiMateoAko 05-18-2006 04:47 PM

Lots of info here. If you're like me and don't want to add 30 lines of code to your img tags, do what I did.

replace this:

Code:

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

Code:

return '<img style="max-width:800px; width: expression(this.width > 800 ? 800: true);" src="' .  $link . '" border="0" alt="" />';
The code you want to replace is found in the function handle_bbcode_img_match() in class_bbcode.php. For me it was on line 1831.

This is fast and will work with either firefox or IE. It may even work with Opera, but I don't know.

encryption 05-19-2006 03:13 PM

I installed the mod and the resizing works perfectly, however I cant parse images as links anymore.

Smiry Kin's 05-22-2006 01:17 AM

works perfect in 3.5.4

Nathan2006 05-23-2006 07:21 AM

Thank you ggiersdorf

Just what I have been looking for :D

Install;)

encryption 05-23-2006 11:52 AM

so none of you are having the issue with parsing images as links ?

skooby 05-23-2006 08:21 PM

I'm having a problem with my news portal in my CMPS.

When I added the code, it resizes images in the posts. But when the Module tries to grab the resized image to post it on the homepage, it won't display the image if it is over the size that I set for it.

I used S@NL - BlackBik code in post# 47

I basically want the news module to grab the information in a selected forum on my site which includes an image in each post, and post that image on the main page in the news module, but the images need to be resized to fit the page correctly. If the image is over the set width of 400, it won't resize and display, it just doesn't display it period. It does resize it though if I go to the actual post. I need it to resize the image so it is displayed correctly in the news module of my CMPS on the mainpage.

Any ideas how to fix this?

epicbear 05-24-2006 05:18 PM

Ok, I installed this and it works great on the images but the whole problem I was having hasn't gone away.

On this page,

http://forums.epicski.com/showthread.php?t=33971

the offending image was in post #6. As you can see, it's resized. If you're viewing the page with Firefox...it looks fine. If you're viewing the page in IE...the tables still blow out really wide and require much horizontal scrolling.

Any ideas what's going on here?

epicbear 05-24-2006 05:49 PM

Quote:

Originally Posted by epicbear
Ok, I installed this and it works great on the images but the whole problem I was having hasn't gone away.

On this page,

http://forums.epicski.com/showthread.php?t=33971

the offending image was in post #6. As you can see, it's resized. If you're viewing the page with Firefox...it looks fine. If you're viewing the page in IE...the tables still blow out really wide and require much horizontal scrolling.

Any ideas what's going on here?

Nevermind...:confused:

bada_bing 05-24-2006 06:17 PM

Installed and working good so far on vb 3.5.3

Thank You

blacklancer 05-26-2006 04:11 PM

Quote:

Originally Posted by SiMateoAko
Lots of info here. If you're like me and don't want to add 30 lines of code to your img tags, do what I did.

replace this:

Code:

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

Code:

return '<img style="max-width:800px; width: expression(this.width > 800 ? 800: true);" src="' .  $link . '" border="0" alt="" />';
The code you want to replace is found in the function handle_bbcode_img_match() in class_bbcode.php. For me it was on line 1831.

This is fast and will work with either firefox or IE. It may even work with Opera, but I don't know.

thats where its at! perfect! doesn't mess with the sigs at all. thanks so much!

:banana::banana::banana:

Neurotoxin 05-28-2006 02:06 AM

Awesome mod, works perfect!

Bulent Tekcan 05-28-2006 08:07 PM

Quote:

Originally Posted by ggiersdorf
The problem I am running into now is basically Signatures are used with the IMG tag this mod changes anything that has the IMG tag.

We need to re-write the $signature to use an alternate img tag like [SIG] [SIG] or somehow have the field for signatures remove the script above and use the default one from Vb. Basically trick it in signatures to use original vb code.

PHP Code:

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

anyone want to help with this let me know I have some updated code than the above that works better but Im holding off posting it till were done here..

Same problem here....this hack removed :tired:

jags2ooo 05-29-2006 05:49 PM

SiMateoAko AWESOME IT WORKS PERFECT!!!!!!!!! i just opened up a new forums 1 hour ago and of course some dude had to post a image that was so FREaking big and fked up the boards so i cam ehere ran a search and bam your fix owns :) THANKS!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!11

I recommend Simateoako's version of this mod his is posted at post number #106 its nice and short only 1 line :D

Djamil 06-03-2006 04:39 PM

Quote:

Originally Posted by S@NL - BlackBik
Find:
Code:

return '<a href="' .  $link . '" target="_blank"><img src="' .  $link . '" border="0" alt="' . $vbphrase['click_for_larger_image'] . '" style="width: expression(this.width > 600 ? 600 : true);" /></a>'; 
} else { 
return '<a href="' .  $link . '" target="_blank"><img src="' .  $link . '" border="0" alt="' . $vbphrase['click_for_larger_image'] . '" style="max-width: 600px;" /></a>'; 
}

and replace by:
Code:

return '<a href="' .  $link . '" target="_blank"><img src="' .  $link . '" border="0" alt="' . $vbphrase['click_for_larger_image'] . '" style="width: expression(this.width > 600 ? 600 : true);" /><br><br>' . $vbphrase['click_for_larger_image'] . '</a>'; 
} else { 
return '<a href="' .  $link . '" target="_blank"><img src="' .  $link . '" border="0" alt="' . $vbphrase['click_for_larger_image'] . '" style="max-width: 600px;" /><br><br>' . $vbphrase['click_for_larger_image'] . '</a>'; 
}


I can't manage to make the phrases work.

The line breaks are there but the phrase text is missing. I triple-checked the phrase names, they are correct. Even the version posted in https://vborg.vbsupport.ru/showthread.php?p=52 doesn't show the phrase in the alt-tag. Any hints ?

Djamil

Djamil 06-04-2006 12:53 PM

I found out myself. There's important information missing in Post 52. If you defined the phrases as global phrases (which seemed the appropriate way to me since there was no specific phrasetype mentioned to define them in) and want the phrases to show up, you must do the following:

FIND

Code:

function handle_bbcode_img_match($link)
        {

ADD AFTER

Code:

global $vbphrase;
Then the phrases will show up.

For further information please consult this chapter of the vB manual

Djamil


All times are GMT. The time now is 05:58 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.01384 seconds
  • Memory Usage 1,868KB
  • 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
  • (10)bbcode_code_printable
  • (2)bbcode_php_printable
  • (12)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (3)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (40)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