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)

DanLai 10-24-2005 10:00 PM

Auto resize large image
 
In fact this is a work around for the auto resize feature to work with the WYSIWYG editor.

Step1. In includes/class_bbcode.php

Find (in line around 18xx):
Code:

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

return '<img src="' . $link . '" onload="if(largerThan(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" />';
Step2. Modify the common template of your template set

Add this to the headinclude section:
Code:

<script type="text/javascript">
function largerThan(a,b)
{
return a>b;
}
</script>

Demo:
http://talkmusic.org/showthread.php?t=3165

swantonio 10-25-2005 05:28 PM

good grazie ... .-)

Allan 10-25-2005 05:41 PM

Simple effective, I like ;)

congratulation

"Click Install" ;)

nokturno 10-25-2005 06:30 PM

congratulation

Pramodinfo 10-25-2005 07:23 PM

*Clicks Install* :) Thanks

CBE 10-25-2005 08:47 PM

This is the best image resizer i have seen,,
thank u very much

COBRAws 10-25-2005 09:25 PM

What's the way for adding a text that says something like "Click on the image to see orginial size"?

ORIGINAL MOD:
Code:

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

WITH TEXT BELOW:
Code:

return '<img src="' . $link . '" onload="if(largerThan(this.width,700)) {this.width=700;this.alt=\'Click here to see a large version\';}" onmouseover="if(this.alt) this.style.cursor=\'hand\';" onclick="if(this.alt) window.open(\'' . $link . '\');" border="0" /><br /><p>Click on the image to see original size<p />';
Someone please tell me if this is ok.

Barakat 10-25-2005 11:48 PM

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

Xplorer4x4 10-26-2005 07:57 AM

This belongs in the code modification forum as it it edits one of the orignal vB scripts.

Snake 10-26-2005 08:24 AM

I've been looking for this. Thanks!

xware 10-26-2005 09:17 AM

<a href="https://vborg.vbsupport.ru/showpost.php?p=742150&postcount=5" target="_blank">https://vborg.vbsupport.ru/showp...50&postcount=5</a>

Freezerator 10-26-2005 01:46 PM

Can this be a module/product? :)

GuaRRand 10-26-2005 08:47 PM

wokred perfectly!
Also no weird codes when i quote a post with a resized image!!

moonclamp 10-26-2005 10:30 PM

Quote:

Originally Posted by GuaRRand
wokred perfectly!
Also no weird codes when i quote a post with a resized image!!

Yep ... this one works properly.

No more big pages :)

Allan 10-27-2005 09:39 AM

so , don't work with IE

moonclamp 10-27-2005 06:25 PM

Quote:

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

try changing the dimensions in the script down to '540' rather than '700'

evenmonkeys 10-27-2005 08:04 PM

Can this be made via plugins / products? I'd rather not modify my code unless I absolutely have to.

Allan 10-27-2005 08:32 PM

Quote:

Originally Posted by moonclamp
try changing the dimensions in the script down to '540' rather than '700'

tested and no change

work perfectly with Firefox, but with IE, don't work :(

evenmonkeys 10-28-2005 03:07 AM

This is not working for me. :(

EDIT: This is working in Firefox and not IE.

Rhoads 10-28-2005 04:01 AM

Thnx DanLai, working 100% with IE ;)
IE users, try to install java from microsoft

evenmonkeys 10-28-2005 04:18 PM

I have java installed.

._.

Allan 10-28-2005 04:23 PM

Quote:

Originally Posted by xYarub
I have java installed.

._.

also to install

moonclamp 10-28-2005 07:01 PM

Could this be adapted to shrink profile pictures?

Does anyone know how?

If so I could then let members upload bigger pics without it throwing their profiles out of alignment

evenmonkeys 10-28-2005 11:56 PM

Quote:

Originally Posted by Allan
also to install

Huh?

ggiersdorf 10-29-2005 09:33 PM

Please look into this Firefox works fine, IE it does not resize. Im not the only one IM sure it's just a tweak needed..

Vtec44 10-30-2005 05:46 AM

It's working for perfectly on my site, both IE and Firefox.

ggiersdorf 10-30-2005 09:39 AM

I dont understand why does this work on some and not all IE machines? does it matter where you place the code in the header!? shouldnt can some please verify this I need it working BADLY on IE!

moonclamp 10-30-2005 09:55 AM

you don't put it in your header template, you put it in your headinclude template

ggiersdorf 10-30-2005 11:06 AM

Sorry thats what I meant!! I did do that, and I installed Java

still nothing.

Vtec44 10-30-2005 02:51 PM

Quote:

Originally Posted by xware

The problem with that code is that it won't work if a user quotes the picture.

evenmonkeys 10-31-2005 01:42 AM

Well, what I don't like about this so far is that it's never working on IE for me, and it also limits the size in the signatures. I'm looking for something that is only limited in the post and the signature limits do their own work. >_<;

ferrarislave 11-01-2005 12:20 AM

Quote:

Originally Posted by xYarub
Well, what I don't like about this so far is that it's never working on IE for me, and it also limits the size in the signatures. I'm looking for something that is only limited in the post and the signature limits do their own work. >_<;

Mod is not working for me in IE either, only in FireFox, what gives? Can someone help!!?

Vtec44 11-01-2005 12:52 AM

What version of IE are you guys using? I'm using IE6 and it seems to be working fine.

ggiersdorf 11-01-2005 11:32 AM

Mabey it has something to do with where you place it? Vtec please post a few lines above and below where you posted the text and anything else that might help us. I cannot get it to work either on my site Firefox fine, but ie 6+ does not.

DanLai 11-01-2005 01:17 PM

Some guide questions for users in trouble (with IE), please answer them so I could have the clue to solve your problem. :rolleyes:

1. Can you see the demo working on IE? (Can -> 2, Cannot->3)
2. Please let me see your forum page where this mod is applied.
3. If you cannot see it working, what version of IE are you using?

Thanks!
DanLai.

ggiersdorf 11-01-2005 01:22 PM

Example:

http://www.sonyverse.com/forum/showthread.php?t=11

here is my code

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


in Firefox it resizes fine in IE this is what I get..

kONGO 11-01-2005 01:24 PM

Quote:

Originally Posted by ggiersdorf
Mabey it has something to do with where you place it? Vtec please post a few lines above and below where you posted the text and anything else that might help us. I cannot get it to work either on my site Firefox fine, but ie 6+ does not.

It's in the PHP function handle_bbcode_img_match you need to make the change. In that function it is quite clear where the change must be applied (it's a very small function).

Also, as an addition, there is no need to define the largerThan() function. Using
Code:

if (this.width > 700)
works just as well. I've tested this and it works beautifully on Firefox 1.5b2, IE6sp1, Opera 8.

ggiersdorf 11-01-2005 01:55 PM

Kongo IM new sorry can you please explain where and what needs modified for us so we can enjoy the benifits of this mod?

Thanks in advnace..

Look at my code above thats in the bbcode php file

kONGO 11-01-2005 02:12 PM

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.

DanLai 11-01-2005 04:01 PM

Quote:

Originally Posted by ggiersdorf
Example:

http://www.sonyverse.com/forum/showthread.php?t=11

here is my code

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


in Firefox it resizes fine in IE this is what I get..

I see the mod working for your site in IE. Maybe the mod is affected by some Javascript settings in IE? What version of IE are you using?

Quote:

Originally Posted by kONGO
It's in the PHP function handle_bbcode_img_match you need to make the change. In that function it is quite clear where the change must be applied (it's a very small function).

Also, as an addition, there is no need to define the largerThan() function. Using
Code:

if (this.width > 700)
works just as well. I've tested this and it works beautifully on Firefox 1.5b2, IE6sp1, Opera 8.

The ">" will cause problem when you try to edit the post. :)

Good to see everyone helping out each other. :rolleyes:

Thanks,
DanLai.


All times are GMT. The time now is 08:48 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.01697 seconds
  • Memory Usage 1,826KB
  • 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
  • (10)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
  • (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