The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
Image resize on non hosted images Details »» | |||||||||||||||||||||||||
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="" />'; 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" />'; } 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
|
Comments |
#2
|
||||
|
||||
I'm going to test this out, but it looks like it will effect signatures.
|
#3
|
||||
|
||||
HTML Code:
error: parse error, unexpected T_IF, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in /html/includes/class_bbcode.php on line 1971 |
#4
|
|||
|
|||
You are missing the { and } to surround the IF statement.
This is a copy of my code... a few line above and below of the original insert. Code:
* @param string The URL to the image. * * @return string HTML representation of the tag. */ function handle_bbcode_img_match($link) { $link = $this->strip_smilies(str_replace('\\"', '"', $link)); // remove double spaces -- fixes issues with wordwrap $link = str_replace(' ', '', $link); {if (preg_match("/yourDomain.com/i", $link)) { return '<img src="' . $link . '" border="1" />'; } else { return '<img src="' . $link . '" border="1" height="100" width="100" />'; } } # return '<img src="' . $link . '" border="0" alt="" />'; } /** * Removes the specified amount of line breaks from the front and/or back * of the input string. Includes HTML line braeks. UPDATE: I just checked the test posts, it appears it will effect the signatures. I'll update it to not effect sigs later tonight. UPDATE 2: I found out why my test didn't catch the sig images... I have a custom BB code for Sig images. |
#5
|
||||
|
||||
Yeah. I've got that same problem. I've been trying to seperate posts from signatures... but can't.
|
#6
|
||||
|
||||
Definitely going to install this once I get back to home!
|
#7
|
|||
|
|||
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! |
#8
|
|||
|
|||
I think the other hack, https://vborg.vbsupport.ru/showthrea...ght=image+size might work better for you.
I wanted it to crush them down, so the users knew that the image was not hosted on our servers, and if anything adult was posted, it wouldn't be as noticable. I am working on this now, to prevent the signature images being effected. |
#9
|
||||
|
||||
helo....
just let me a bit more clear....xplaining In our forum: we use imageshack.us & photobucket.com 's free image host service.. will this hack create all the image hosted on those both place to thumbnail ? and it should not touch the sigs that also hosted on photobucket/imageshack? will this hack only works on pre-define domain? wont it work on universal?? Waiting for some xplanation... Thankx |
#10
|
|||
|
|||
Quote:
I have code for just the users posts, but it's causing an error in the quick reply of 3.5.3. The new code, not yet posted, does work with only the posts, and not the sigs, but the quickreply error is slowing me down. I hope to have the 2nd code up soon, once I find out why the error is being generated. |
Thread Tools | |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|