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
  #32  
Old 01-13-2006, 10:33 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

Does anybody know if there's a way to only resize and add a link if the image realy IS wider than the specified width?
Reply With Quote
  #33  
Old 01-13-2006, 11:47 PM
apfparadise apfparadise is offline
 
Join Date: Jan 2005
Location: Northridge CA
Posts: 110
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I have been begging in several places on this site, and have offered some $$ for a script that equals the 3.0 version that was FLAWLESS. This one makes all into links, and does not resize properly, and plain does not do anything in Opera.

I thank ggiersdorf for the start, but I really wish someone would step up and finish it up. I just got a copy of the "no img for guests" finally, with a plugin and very solid.
Reply With Quote
  #34  
Old 01-14-2006, 12:25 PM
ggiersdorf ggiersdorf is offline
 
Join Date: Aug 2005
Posts: 251
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Sorry guys I have been out of town for a while, just got back apfparadise what is your site?

Pm the info if you wish I will take a look and see if i can help..
Reply With Quote
  #35  
Old 01-14-2006, 01:52 PM
bashy bashy is offline
 
Join Date: Nov 2005
Posts: 2,544
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

This line is not in my class_bbcode.php im using 3.5.2

return '<img src="' . $link . '" border="0" alt="" />';
Reply With Quote
  #36  
Old 01-14-2006, 06:44 PM
apfparadise apfparadise is offline
 
Join Date: Jan 2005
Location: Northridge CA
Posts: 110
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Bashy, the line is there, unfortunately the spacing in the post above is a bit different, so when you do a search it does not come up. Look for it manually. Took me a while too, but it's there.

ggiersdorf, I dont have it on right now, so going to my site wont help you. These are the concerns you have to look for, check them on your board too, they should be there.

1. The images that are within your set parameters should NOT be clickable, only the ones that are bigger and getting resized.

2. The images do not get resized properly. In Opera, there is no resizing for anything, just does not work, I have tried different sizes.

3. Below is a link to the 3.0 version that worked PERFECTLY I ran on my site for a long time. IT's the only one I know of that works every time. I think the new build has to start by looking at it and following that strategy. May talk to the original owner, I have asked about a port but did not get a reply.
https://vborg.vbsupport.ru/showthread.php?t=67743

BTW, I am on AIM, APFparadise. If you want to do a session I will install it quickly ( I have the edited file on my server, just need to rename 2 files) and you can take a look at it, I just dont want to run it on the site long term till it's done.
Reply With Quote
  #37  
Old 01-14-2006, 07:08 PM
bashy bashy is offline
 
Join Date: Nov 2005
Posts: 2,544
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

thanks apfparadise
That sorted it
Clicked install
Reply With Quote
  #38  
Old 01-15-2006, 07:39 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

I've taken some of the code of the old hack and mixed it with the new code.
The image will now be left alone if smaller than the width you specified:
Code:
Deleted old code
Note: If you want to use the vBphrase I use, check this post .
Reply With Quote
  #39  
Old 01-15-2006, 09:31 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

OK, found out that I've introduced error messages on forumpages when the image wasn't found. So I ripped some more code from the old hack by Steve St.Lauren and added it to the new code by ggiersdorf.
Seemes it works fine now

Code:
Check the revised code in post #52
Note that I introduced two more phrases (image not found and imageserver offline). Feel free to use plain text instead. Otherwise, don't forget to add those (global) prhases
Reply With Quote
  #40  
Old 01-16-2006, 04:51 AM
apfparadise apfparadise is offline
 
Join Date: Jan 2005
Location: Northridge CA
Posts: 110
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

S@NL -thanks for the work, almost there. Still does not work in Opera, it links the file but does not resize it. 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.

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.

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:



and



Can they be shown if there is no image?

again, thx for this.
Reply With Quote
  #41  
Old 01-16-2006, 05:05 AM
Zia's Avatar
Zia Zia is offline
 
Join Date: Dec 2005
Location: golpo.net
Posts: 931
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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.
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:43 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.08276 seconds
  • Memory Usage 2,321KB
  • 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_code
  • (2)bbcode_php
  • (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