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
Image resize on non hosted images Details »»
Image resize on non hosted images
Version: 1.00, by vtx1800 vtx1800 is offline
Developer Last Online: Feb 2012 Show Printable Version Email this Page

Version: 3.5.3 Rating:
Released: 01-21-2006 Last Update: Never Installs: 1
Code Changes  
No support by the author.

This is my first attempt on vB code changes, so I hope this works. I also believe this should be a vB ACP feature in the near future.

Credit: I was reading this thread and decided to make this hack. I used it as a place to start and make my version.

What this does: What this will do is restrict images that a user posts that are not hosted on a user defined server.

1. All images not hosted on a defined server will be set to 100x100.
2. User can set the host domain to allow normal image sizes.

Reason for this: I wanted this code to prevent a user from posting a huge image and cause the forum layout to get destroyed. I hated it when a image size of 1024x768 gets posted and my forums width is only 700px.

To install: I don't know how to make a plugin, so it's all via editing the "class_bbcode.php" file in the /includes folder.

Find: (Line 1828)

Code:
return '<img src="' .  $link . '" border="0" alt="" />';
Replace with: (Note this must be enclosed with the {} to work.)
Code:
{if (preg_match("/allowedDomain.com/i", $link)) 
			{
   			return '<img src="' .  $link . '" border="1" />';
			} else {
  			return '<img src="' .  $link . '" border="1" height="100" width="100" />';
			}
You must change the "allowedDomain" text to be the site you want to allow. So, if you want to allow http://www.putfile.com, do not include the 'http' or 'www'.

Hope this is useful to all of you, I know it's something I was looking for, but never found. If it is on the site, sorry, I can't seem to find much with the search feature.

If you like it, please click INSTALL if you use it.

All comments are welcome, as this was my first attempt and would like to make more.

Show Your Support

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

Comments
  #12  
Old 01-24-2006, 05:39 AM
Zia's Avatar
Zia Zia is offline
 
Join Date: Dec 2005
Location: golpo.net
Posts: 931
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

nice to know...this will generate thumbnail any image within code...

but the same probs...re-size sigs...:S

will it follow the pre-defined domain name for thumbnail gen. ???

Its nice ..
waiting for ur modication/update..

Thnkx for prompt-reply.
Reply With Quote
  #13  
Old 01-29-2006, 10:36 AM
ggiersdorf ggiersdorf is offline
 
Join Date: Aug 2005
Posts: 251
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Regardless of what you do they are still using the [IMG] tag so all images signatures included will be resized. I mad a slight modification to the code in my post that allows any image over 500ox to be resized down to 150 or whatever and that allows my signatures to be up to 400-500 size plenty for users..

Though an Ideal fix would be to create something that ignores the img tag when used within the $signature tag.. I am working on this and having some success.
Reply With Quote
  #14  
Old 01-30-2006, 06:40 PM
vtx1800 vtx1800 is offline
 
Join Date: Nov 2005
Location: California
Posts: 36
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by ggiersdorf
Regardless of what you do they are still using the [IMG] tag so all images signatures included will be resized. I mad a slight modification to the code in my post that allows any image over 500ox to be resized down to 150 or whatever and that allows my signatures to be up to 400-500 size plenty for users..

Though an Ideal fix would be to create something that ignores the img tag when used within the $signature tag.. I am working on this and having some success.

I have the code (very different that this one) to fix the images in the posts, but not the sig. The code works perfectly. Problem is, in 3.5.3, it is causing a double post in the quick reply. ggiersdorf, you want to team up with me and help figure this out?
Reply With Quote
  #15  
Old 01-31-2006, 08:06 AM
lazytown lazytown is offline
 
Join Date: Feb 2004
Posts: 503
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Wouldn't it be better to implement an image auto-resize client side with javascript? That way a user can click to enlarge it, the aspect ratio would be correct, and it wouldn't have any server impact. It looks like this one has no server impact, but it produces ugly thumbs and I don't think its really an improvement over the one you copied it from at all (with the exception of ignoring a user specified server). The one you copied it from maintaned the aspect ratio.

-vissa
Reply With Quote
  #16  
Old 01-31-2006, 06:20 PM
vtx1800 vtx1800 is offline
 
Join Date: Nov 2005
Location: California
Posts: 36
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by vissa
Wouldn't it be better to implement an image auto-resize client side with javascript? That way a user can click to enlarge it, the aspect ratio would be correct, and it wouldn't have any server impact. It looks like this one has no server impact, but it produces ugly thumbs and I don't think its really an improvement over the one you copied it from at all (with the exception of ignoring a user specified server). The one you copied it from maintaned the aspect ratio.

-vissa
Thats why the credited version would be better for you.

I could care less about the ratio when a person hosts huge images. Plus, I want it crushed, so the members will know the image is off my server and not, well, approved. I removed the link from this, but it would be an easy add to get an href added.
Reply With Quote
  #17  
Old 01-31-2006, 06:53 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

Vissa, check this post, an anwer to this question 'bout javascript that you also posted in that thread
Reply With Quote
  #18  
Old 02-01-2006, 03:17 AM
Zia's Avatar
Zia Zia is offline
 
Join Date: Dec 2005
Location: golpo.net
Posts: 931
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

finally what comes with this ?

exclude sigs ...possible?
Reply With Quote
  #19  
Old 03-17-2006, 11:01 PM
hiiped hiiped is offline
 
Join Date: Jan 2006
Posts: 151
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by RyanC
Is there anyway to do this just by width so that the image doesn't lose aspect ratio? I hate it when folks break my designs with big ole images, but I don't want to torture their images either... just curious.

thanks!
use

border="1" width="100" /

OR

border="1" height="100" /
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 08:34 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.05931 seconds
  • Memory Usage 2,283KB
  • Queries Executed 23 (?)
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
  • (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
  • (1)pagenav_pagelink
  • (9)post_thanks_box
  • (9)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (9)post_thanks_postbit_info
  • (8)postbit
  • (9)postbit_onlinestatus
  • (9)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