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 Your Images 3.52 compliant Details »»
Auto Resize Your Images 3.52 compliant
Version: 1.00, by ggiersdorf ggiersdorf is offline
Developer Last Online: Aug 2012 Show Printable Version Email this Page

Version: 3.5.3 Rating:
Released: 12-27-2005 Last Update: Never Installs: 100
Template Edits
Code Changes  
No support by the author.

I was looking for some code that would allow an image over size x to be resized in IE, Firefox, and Opera. I tried all the variations out there without luck some would work in IE, some in Firefox, etc.. So I finally got a tweaked version of some old code that actually works flawless in IE, Firefox, and Opera. I have included it below, but It needs 1 final tweak that I'm hoping someone in the community can help with.

i am NOT taking credit for this hack, all I have done is tweak it to get it working for me..


This code has been updated as of 8:30pm with the clickable link built in now!

Step 1: Edit your class_bbcode.php file located in (root/includes)

find

PHP Code:
return '<img src="' .  $link '" border="0" alt="" />'
replace with the following.

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

/* End Image RESIZE */ 
you can play with the widths to get what you want working.

Show Your Support

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

Comments
  #42  
Old 01-16-2006, 08:44 AM
S@NL - BlackBik's Avatar
S@NL - BlackBik S@NL - BlackBik is offline
 
Join Date: Jul 2004
Location: Netherlands
Posts: 307
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by apfparadise
S@NL -thanks for the work, almost there. Still does not work in Opera, it links the file but does not resize it.
I didn't test it in Opera because only 1% of our users use Opera.
Remember I'm not a coder, I just took two hacks and tried to combine them. I have no clue why it's not working in Opera. Maybe you'll have to let Opera identify itself as MS-IE.

Quote:
Originally Posted by apfparadise
The other two browsers are spot on, I changed the size to 800 px so maybe I made a mistake. I changed the first one that says "If image is more than ..." and made 800 and then I changed both browser options to 800 (the IE one is 800 ? 800 right?) and it works fine on IE and Firefox, but not Opera.
Good to hear the other browsers are working
Yes, there are three instances where you have to change the size to the one you want. The IE one is 800 ? 800.

Quote:
Originally Posted by apfparadise
Also, what is the phrase for resizing supposed to do, it does not show it anywhere. I thought it would be a text line under the image to show that it should be clicked.
The "click message" is a "alt-tag" in the image that shows when you hoover you're mouse over the shrinked image. With the phrase you can change the message that appears. It is not a text line under the image. I introduced the phrases cause we run a multilanguage board
When you're not, you can easely change the phrases to hardcode text.

Quote:
Originally Posted by apfparadise
Also, I am not sure, but can it be made when the image is not available or the server times out for it to show an image? I created two images like this:
<snap>
and
<snap>

Can they be shown if there is no image?

again, thx for this.
I don't know. Right now it's just a text in a small table. It may be possible to use the image. Just substitute the phrases for a imagetag and see if it works.

And you're welcome. I needed this for myself, that's why I looked in to it
Reply With Quote
  #43  
Old 01-16-2006, 08:47 AM
S@NL - BlackBik's Avatar
S@NL - BlackBik S@NL - BlackBik is offline
 
Join Date: Jul 2004
Location: Netherlands
Posts: 307
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Zia
hello...its a really hack...been long time looking for one that works propely..
as i saw here image hosted on other site like imageshack or photobucket..
will that image also be resized as per my requairment?
also lots of CODE here..kinda taugh to reliasize which one is for what?

just any one can tell me..
will this hack re-size/clikable image that hosted on imageshack works on IE,Opera,FireFox..

Waiting for help

Thankx.
Hello Zia.
The code in the first post is the official hack by ggiegersdorf.
I just costumized this code. The latest revision of my code is in post #38.

This will resize every image when it's wider than the specified width. It does work in IE and Firefox. It doesn't seeme to work in Opera.
Reply With Quote
  #44  
Old 01-16-2006, 08:01 PM
apfparadise apfparadise is offline
 
Join Date: Jan 2005
Location: Northridge CA
Posts: 110
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

S@NL - it's the funniest thing. My opera was setup to identify as IE. After your comment I went to check, switched it to "Identify as Opera" and it works Now it's working flawlessly, except I gotta work out how to properly add the tag on the bottom. Will get it tonight, and post here.
Reply With Quote
  #45  
Old 01-16-2006, 09:50 PM
S@NL - BlackBik's Avatar
S@NL - BlackBik S@NL - BlackBik is offline
 
Join Date: Jul 2004
Location: Netherlands
Posts: 307
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

LOL, just let Opera work as designed (as itself that is) and it works
OK, that's good to know.

I found a little bug though.
It seemes that image url's with al space in it, that translates to %20, can not be displayed by this hack. Have to look into that....
Reply With Quote
  #46  
Old 01-17-2006, 04:19 AM
Zia's Avatar
Zia Zia is offline
 
Join Date: Dec 2005
Location: golpo.net
Posts: 931
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by S@NL - BlackBik
Hello Zia.
The code in the first post is the official hack by ggiegersdorf.
I just costumized this code. The latest revision of my code is in post #38.

This will resize every image when it's wider than the specified width. It does work in IE and Firefox. It doesn't seeme to work in Opera.

Thankx Man..

Its does'nt work on opera.....it could be okay some time..tho personally i use opera..

but theres a porbs ..it also resize sigs.....infact image posted in a post that image will be resize or thumnail (100X75) .
our sigs limit is : 300X100.
all of the sigs turn to 100X75 ... :ermm:

can u tell me how to do that...this modification only works on image that posted in a post..& it will ignore the image in sigs..


plz let us know urgently...getting lots of complain from user..... :surprised:
Reply With Quote
  #47  
Old 01-17-2006, 05:09 AM
apfparadise apfparadise is offline
 
Join Date: Jan 2005
Location: Northridge CA
Posts: 110
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

S@NL, now if you only could place the code in for the border with the "Click to see full size image" so that I dont have to break my brain trying to figure it out and fail, that would be awesome.
Reply With Quote
  #48  
Old 01-17-2006, 08:09 AM
S@NL - BlackBik's Avatar
S@NL - BlackBik S@NL - BlackBik is offline
 
Join Date: Jul 2004
Location: Netherlands
Posts: 307
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Zia
Its does'nt work on opera.....it could be okay some time..tho personally i use opera..
It does work in Opera. Just let Opera identify itself as Opera and not as MSIE. See the post just above yours.

Quote:
Originally Posted by Zia
but theres a porbs ..it also resize sigs.....infact image posted in a post that image will be resize or thumnail (100X75) .
our sigs limit is : 300X100.
all of the sigs turn to 100X75 ... :ermm:

can u tell me how to do that...this modification only works on image that posted in a post..& it will ignore the image in sigs..
Just don't resize the images to such a small size but set the width parameters to 300 (same as your sig images).

I don't know how to not make this work on sigs.
As I said, I'm not a coder, nor do I support this hack. I just want to share some modifications I made to the code from ggiegersdorf. If you can't use it, then don't.
I'm not gonna code stuff I don't want to use on my own board.

The only thing I will do is try to sort out why some images aren't showing when there is some special character in it's url. For the rest you're on your own
Reply With Quote
  #49  
Old 01-17-2006, 09:00 AM
Zia's Avatar
Zia Zia is offline
 
Join Date: Dec 2005
Location: golpo.net
Posts: 931
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

got ur word.. S@NL - BlackBik

as i read it..it wont touch the image if the image, is smaller than defined size inside hack....

so now i can change resized image hack larger than sigs(300X100)
like 300X225..
in that case it wont touch the sigs..

in that case it wont create thumbnail & wont touch the sigs??

hehe so many qus?

rater should i PM the main author? :surprised:
Reply With Quote
  #50  
Old 01-17-2006, 09:01 AM
Zia's Avatar
Zia Zia is offline
 
Join Date: Dec 2005
Location: golpo.net
Posts: 931
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

got ur word.. S@NL - BlackBik

as i read it..it wont touch the image if the image, is smaller than defined size inside hack....

so now i can change resized image hack larger than sigs(300X100)
like 300X225..
in that case it wont touch the sigs..

in that case it wont create thumbnail & wont touch the sigs??

hehe so many qus?

rater should i PM the main author? :surprised:

umm want that this mod will create thumbnail to 100X100 but it wont touch sigs.so sigs size will remain as it is/was
Reply With Quote
  #51  
Old 01-17-2006, 11:42 AM
S@NL - BlackBik's Avatar
S@NL - BlackBik S@NL - BlackBik is offline
 
Join Date: Jul 2004
Location: Netherlands
Posts: 307
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Zia
got ur word.. S@NL - BlackBik

as i read it..it wont touch the image if the image, is smaller than defined size inside hack....

so now i can change resized image hack larger than sigs(300X100)
like 300X225..
in that case it wont touch the sigs..

in that case it wont create thumbnail & wont touch the sigs??


hehe so many qus?

rater should i PM the main author? :surprised:

umm want that this mod will create thumbnail to 100X100 but it wont touch sigs.so sigs size will remain as it is/was
This mod was NOT designed to make thumbnails.
Just to make images smaller so they don't mess up the forumlayout.
That's why the sizecheck ONLY checks the width of the image and NOT the height.

But now I understand your problem. And you understood ok, if you define the maximum width of a image bigger or as big as your signature images, it won't touch the them.
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 02:47 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.04873 seconds
  • Memory Usage 2,333KB
  • 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
  • (2)bbcode_php
  • (9)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
  • (1)pagenav_pagelinkrel
  • (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