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 large image (https://vborg.vbsupport.ru/showthread.php?t=99286)

S@NL - BlackBik 01-26-2006 11:48 PM

Hi Marris,
I tried your code, but it doesn't work for me:
- In IE the image is resized and opens in a pop-up, but the alt tag doesn't show when hoovering over the image with my mouse, although I see it in the source of the page (this.alt='text')
- In FF the images are not affected at all. They don't resize (FF 1.5). In the source of the page I see the script, but it's doing nothing I'm afraid.

S@NL - BlackBik 01-26-2006 11:57 PM

Sorry mate, forget it.
I forgot to edit the headinclude template.....

My bad, hack works like a charm :)

evenmonkeys 02-10-2006 04:55 PM

Quote:

Originally Posted by Marris
Well, I've got a semi-working popup in IE with ggiersdorf's code. This is the most consistent for me, but still not perfect:

Code:

$navigator_user_agent = ( isset( $_SERVER['HTTP_USER_AGENT'] ) ) ? strtolower( $_SERVER['HTTP_USER_AGENT'] ) : '';
if (stristr($navigator_user_agent, "msie")) {
    return '<img src="' .  $link . '" border="0" onload="if(this.width >= 400) {this.alt=\'Click here to see the orignal image\';}" style="width: expression(this.width > 400 ? 400 : true);" onmouseover="if(this.width >= 400) {this.style.cursor=\'pointer\';}" onclick="if(this.width >= 400) window.open(\'' . $link . '\',\'Image\',\'toolbar=no, directories=no, status=no, menubar=no, scrollbars=no, resizable=yes\');"/>';
} else {
    return '<img src="' . $link . '" onload="if(largerThan(this.width,400)) {this.width=400;this.alt=\'Click here to see the orignal image\';}" onmouseover="if(this.alt) this.style.cursor=\'pointer\';" onclick="if(this.alt) window.open(\'' . $link . '\');" border="0" />';
}

Replace all occurances of 400 with your desired width value.

In the IE code, instead of if(this.width >= 400), you are welcome to try combinations of these other if statements:

if(largerThan(this.width,400))
if(this.width > 400)
if(this.alt)

But neither of those worked consistently for me. I tried many different combinations and the code block above is what works best for me across IE, Firefox and Opera.

I welcome improvements.

I am having an issue with this. When I go to edit my signature a second time, it displayed the html for that in the signature. It just shows the huge code instead of the image I put it. It doesn't do it the first time around, but it does it if I edit it.

Gizmo999 02-10-2006 09:24 PM

Ok, lets see if I get this right,

I replace the code in includes/class_bbcode with ggiersdorf/Marris's code and then alter the template, no other mods needed??

chrisisonfire 02-19-2006 01:19 AM

This mod worked fine for me, except when you view the same page after you've been automatically forwarded after posting, and then only some images wouldn't resize. However, for a while now I've personally had a problem with posting URL links, in that I'd post a normal link, but the link would open in the form of; http://"http://www..." and of course wouldn't work. So, it appears that my trouble was in the bbcode file we need to edit. I don't suppose anyone else got this problem, did they? o_O

I'd actually like to reinstall this script, as it's one of the best I've seen, but I'd rather be able to post working links, hehe.

Allan 02-19-2006 08:27 AM

don't work for me with vB3.5.3 :(

emtee 02-19-2006 10:09 AM

This works perfect with 3.5.3! Thanks Marris! How about images that are attachments? It'd be great if they can be automatically resized too.

Edit: For attached images, I found a simple, built-in solution. Just rebuild your thumnails with your desired size, and 1 image per row (in vbulletin options message attachment).

Allan 02-19-2006 10:25 AM

It's possible to create un new thraed but it's the brothel :p

Tralala 02-21-2006 12:33 PM

Marris' version working nicely for me. Thanks, gang!

ffevo 02-24-2006 02:02 AM

Quote:

Originally Posted by kONGO
I have modified the original HTML a bit, since I didn't like it. I use the title attribute instead of the alt attribute, since HTML standards state that the alt attribute is to be used by screen reading software, whereas the title attribute is usually used to display a 'tooltip' when the mouse is positioned above the element in question.

Also, the hand pointer one sees when the mouse is moved over a link is actually a cursor called pointer, not hand, in the standards.

So, I use this code:
Code:

return '<img onload="if (this.width > 700) {this.width=700; this.title=\'Click to view normal size\';}" onmouseover="if (this.title) {this.style.cursor=\'pointer\';}" onclick="if (this.title) {window.open(\'' . $link . '\');}" src="' . $link . '" border="0" alt="" />';
I modified the handle_bbcode_img_match function in the file includes/class_bbcode.php.

Works in all browsers I've tested it in. If it works in Firefox but not IE, I would say the best bet is to check the IE settings. JavaScript may be fully or partially disabled.

Does not work in IE at all and when i click on the image to enlarge it, it doesnt do anything.

Freesteyelz 02-27-2006 07:44 PM

Quote:

Originally Posted by Barakat
iam useing this and its usefull also .
in the same file and the same code just find this code :-

PHP Code:

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

replace it with :-

PHP Code:

return '<div style="width: 800px; overflow: auto;"><img src="' $link '" border="0" alt="" /></div>'

it will give u a frame on large pictures and will save ur style as it is .
just choose the width as u want the picture to be shown and thats all ...

any way i will try ur code also

Actually a better way (without editing a .php core file) is to modify the template "postbit" or "posbit_legacy" such as:

Find:

Code:

<!-- message -->
<div id="post_message_$post[postid]">$post[message]</div> <!-- / message -->

Replace with:

Code:

<!-- message -->
                                <div id="hideauto">
<div id="post_message_$post[postid]">$post[message]</div>
                                </div>
<!-- / message -->

And in the Main CSS in the " Additional CSS Definitions " add:

Code:

#hideauto {
width:540px;
padding-bottom:10px;
overflow:auto;
}

1. Change width to specified dimension.
2. Padding is to prevent images (smilies) from being cut off.
3. Overflow can be set to "auto" (for scrollbars) or "hidden" (cutoff excessive images).

*Again, no .php files have been modified for this to work.

Mr Chad 03-04-2006 09:11 PM

Quote:

Originally Posted by Allan
so , don't work with IE

Works great with IE and FF... Only one out that works this good.

Currently useing it on VB 3.5.4

drewclark 03-27-2006 03:25 AM

This is working great in my forums but I use CMPS and it doesn't resize the images that get featured in the news section (pulled from the forums). Any clues on how to get those resized, too? They're the bigger problem for me as the oversized images distort the homepage worse than the forums...

bhxtyrant 07-09-2006 10:02 PM

Hey guys,I was looking for something like this for my forums but having a bit of a problem.I installed this mod and it seems to work sometimes but other times it doesnt.For example i made a test thread and posted a large image around 1024x768 width.I have the mod set to reduce the image to 600px width.It seems to work but if i refresh the page then it is huge again and the only way to get it back to the reduced size is edit the post and save it again.

Small edit:
This seems to work in firefox but the problem occurs in the latest version of IE6.Peraps due to cookies?I tryed deleting temp files to see if that was the cause but problem persists.

jamiepryer@hotm 07-09-2006 10:42 PM

anyone got an example of this working please?
some screen shots please :tu

bhxtyrant 07-10-2006 02:13 AM

Small update again.I notice that this mod is working in other area's such as "view single post" but only not in "Showthread" it seems to be my custom theme that is causing the issue and it seems to work fine on Vb's default theme.I've been going through the code in Showthread template but i cant seem to find whats causing the problem.Anyone think they can assist me?

bhxtyrant 07-12-2006 06:11 PM

Is this mod still supported?

PJSkiboy 07-13-2006 03:39 AM

I installed this in my custom theme and it does not work. I have no idea which mod has this messed up. That's a lot of mods to look through.........eeeeesh.

WeArab 08-07-2006 08:45 AM

Hello,

Great add-on, thank you!

When VB 3.6.0 would be supported?

Eagle Creek 08-08-2006 01:24 AM

Extreme great!!!!!!!

Thankyou!

dtzy 11-06-2006 04:06 PM

I found this is the easiest mod for image resize.

I have modified the code slight, and there is only one modification to be made at class_bbcode.php:

replace:
Code:

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

Code:



There is nothing to be done at headinclude.

                      return '<img src="' . $link . '" onload="if(this.width > 700) {this.width=700;this.alt=\'Click here to see a large version\';}" onmouseover="if(this.alt) this.style.cursor=\'pointer\';" onclick="if(this.alt) window.open(\'' . $link . '\');" border="0" />';


GlitterKill 05-04-2007 01:51 PM

Still a great working hack with vb 3.6.5. I use it alot and love it. :)

radarhunter 06-20-2007 06:28 AM

i wanted sumthin` which can reduce the size of the file on Vbadvanced cmps too

cause this code works only for the forum.

BabyNameAddict 08-21-2007 12:17 PM

I am hoping someone will be able to help me out. Somehow I ended up having both lines (the "find" and the "replace") deleted, and now I can't figure out where to put back the "find" text! If someone could cut and paste the line of code before
Code:

return '<img src="' .  $link . '" border="0" alt="" />';
or the block it's in, I would really appreciate it! Thanks!

FCS-Webmaster 08-23-2007 07:25 PM

Quote:

Originally Posted by CBE (Post 804779)
This is the best image resizer i have seen,,
thank u very much

Years passing by...and I still do agree with this!!!!!!

evervoid 07-03-2009 03:03 PM

Does this work with 3.8.x?

Saqibm 07-04-2009 06:14 AM

Yes I have it working on 3.8.2.

opl 07-16-2009 06:26 AM

Best tip for autoresize. No more slowly mods;]
Works on 372 and 383


All times are GMT. The time now is 09:25 AM.

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.01301 seconds
  • Memory Usage 1,808KB
  • 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
  • (8)bbcode_code_printable
  • (2)bbcode_php_printable
  • (5)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (2)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (28)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