Go Back   vb.org Archive > vBulletin Modifications > Archive > vB.org Archives > vBulletin 3.5 > vBulletin 3.5 Add-ons
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools
Auto resize large image Details »»
Auto resize large image
Version: 1.00, by DanLai DanLai is offline
Developer Last Online: May 2008 Show Printable Version Email this Page

Version: 3.5.0 Rating:
Released: 10-24-2005 Last Update: Never Installs: 145
 
No support by the author.

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

Show Your Support

  • This modification may not be copied, reproduced or published elsewhere without author's permission.

Comments
  #72  
Old 12-24-2005, 11:36 AM
ggiersdorf ggiersdorf is offline
 
Join Date: Aug 2005
Posts: 251
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I had problems like all the rest of you, but I got it working with some modifications on IE-(Maxathon), IE, Firefox, and Opera..

this is what I came up with, along with the code in the original post in headincludes section.

class_bbcode.php


PHP Code:
/* Start Image RESIZE */

 
$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" alt="" style="width: expression(this.width > 640 ? 480 : true);" />'
} else { 
    return 
'<img src="' .  $link '" border="0" alt="" style="max-width: 730px;" />'
}  

/* End Image RESIZE */ 
Only thing I need help with now is making that image clikcable to open in full screen when clicked. Can anyone modify this, and make this the defacto Image resize code!??
Reply With Quote
  #73  
Old 12-25-2005, 09:47 PM
Marris Marris is offline
 
Join Date: Jul 2005
Posts: 45
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by ggiersdorf
I had problems like all the rest of you, but I got it working with some modifications on IE-(Maxathon), IE, Firefox, and Opera..

this is what I came up with, along with the code in the original post in headincludes section.
...
Only thing I need help with now is making that image clikcable to open in full screen when clicked. Can anyone modify this, and make this the defacto Image resize code!??
Thanks ggiersdorf, your IE code is a lot more consistent for me than the javascript. Your IE conditional along with DanLai's original code for other browsers seems to work best for me. Firefox was fine with either, but the DanLai's code seemed to work better in Opera than the max-width line.

I also hope someone can help with adding a "click to resize" link to ggiersdorf's IE code.
Reply With Quote
  #74  
Old 12-27-2005, 01:42 PM
ggiersdorf ggiersdorf is offline
 
Join Date: Aug 2005
Posts: 251
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thanks Marris, I love how it is functioning and Im working on the Clickable code also, though Im not very refined on this stuff. Please anyone with coding experience please help us out and finish off the code above for clickable fullsize images..

Glad I could help..
Reply With Quote
  #75  
Old 12-31-2005, 07:10 PM
coloradok5 coloradok5 is offline
 
Join Date: Dec 2004
Posts: 28
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Anyone have ideas to make this clickable?
Reply With Quote
  #76  
Old 01-05-2006, 08:59 PM
LittleBoy1 LittleBoy1 is offline
 
Join Date: Jul 2005
Location: Lima - Per?
Posts: 32
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

ThanckYou! The Best Hack for Images ultra Small!

SeeYa!
Reply With Quote
  #77  
Old 01-07-2006, 08:08 PM
Marris Marris is offline
 
Join Date: Jul 2005
Posts: 45
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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.
Reply With Quote
  #78  
Old 01-10-2006, 06:02 PM
Bieddos's Avatar
Bieddos Bieddos is offline
 
Join Date: Nov 2001
Posts: 34
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Very good mod!!!
Reply With Quote
  #79  
Old 01-20-2006, 01:09 AM
JaeTea JaeTea is offline
 
Join Date: Jan 2006
Posts: 13
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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:

Haha..holy crap it's actually working for me in Firefox AND IE! :surprised:
Reply With Quote
  #80  
Old 01-26-2006, 02:58 AM
crash resistant crash resistant is offline
 
Join Date: Oct 2004
Posts: 22
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

omg. best. hack. ever.

( the latest modification of it on this page )

TY Marris!!!!!!!!!!!!!!!!!!!!!!
Reply With Quote
  #81  
Old 01-26-2006, 04:51 AM
evenmonkeys's Avatar
evenmonkeys evenmonkeys is offline
 
Join Date: Aug 2004
Location: Iowa
Posts: 896
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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.
Oh my god... it finally works. You are truly me hero.
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 07:07 PM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.05163 seconds
  • Memory Usage 2,317KB
  • Queries Executed 25 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (5)bbcode_code
  • (1)bbcode_php
  • (3)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)modsystem_post
  • (1)navbar
  • (6)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (4)pagenav_pagelink
  • (11)post_thanks_box
  • (11)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (11)post_thanks_postbit_info
  • (10)postbit
  • (11)postbit_onlinestatus
  • (11)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.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/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.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
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete