PDA

View Full Version : Mini Mods - Quick Auto Image-Resize (Posts & Signature)


Gio~Logist
09-05-2011, 10:00 PM
Brought To You By
ModernvB - Vbulletin Solutions & Services
http://www.modernvb.com

Here's a very simple mini-mod that will resize all images in posts & signatures by using a max-width css attribute, along with an onclick function to open the normal-sized picture in a new window.

This product is super simple and has only a few lines of code. Keep in mind that as far as I know, max-width still gets rendered a tad off on IE (not much of a fan with ie anyway, but that's beside the point) on certain versions. Although i tested on IE7 with only a few images and it didn't look so bad at all. Perfect for me on firefox, chrome, etc.

If you're looking for something with a bit more options and functionality (javascript effects, more options, etc.) please take a look at:
Image Resizer (https://vborg.vbsupport.ru/showthread.php?t=236972&highlight=resizer).

Install
1. Import Product
2. Set a Maximum Width in Admincp, under Quick Auto Image-Resize (Posts & Signature)

This really is just a simple mini-mod. Nothing too fancy at all. Had someone who wanted the resizing done strictly with css and suggested I do something like this and offer it as well - so here ya go.

socialteenz
09-06-2011, 04:21 PM
<font color="Red">INSTALLED & RATED *****</font>

Is it possible to make a note saying, click here to view the full size image??

Gio~Logist
09-06-2011, 04:52 PM
I can, i just feel like that would take away from the simplicity of it, maybe an option for it? Hmm

AttalaEA
09-06-2011, 05:31 PM
Excellent Mod Gio. Keep it up. Installed and rated 5 stars.
Thanks. :)

Gio~Logist
09-06-2011, 05:33 PM
Excellent Mod Gio. Keep it up. Installed and rated 5 stars.
Thanks. :)

Thanks a load! :up: Been a while btw, glad to catch you around ;)

socialteenz
09-06-2011, 05:51 PM
I can, i just feel like that would take away from the simplicity of it, maybe an option for it? Hmm

An option would be awesome :)

Quest2be1
09-06-2011, 07:03 PM
Nice hack bro. If you could also have the option to auto-resize by height that would be awesome.

Gio~Logist
09-06-2011, 08:45 PM
Nice hack bro. If you could also have the option to auto-resize by height that would be awesome.

Not a bad idea, the only thing is that max-height is even more sensitive than max-width. But i'm sure some people would want it like that anyway, i'll make sure to note the 2 suggestions i've gotten thus far, they seem fair enough, yet still light.

I just don't want to over complicate things, i could have gotten really crazy with this if i wanted and brought in all sorts of functions, but i kind of wanted a way for people to just be able to hit upload and go about their business.

Quest2be1
09-06-2011, 09:34 PM
Thanks Gio, that's real cool man. I like the idea of keeping it lite too.

j3suss
09-07-2011, 07:29 AM
It´s working in my forum oK!! =)

But I´ve a problem when I do clic in the photo, it happen two things:
-Open new windows with image
+
-In the same window show preview image...

morgano
09-07-2011, 04:30 PM
Anyone have an example of this running?

Dr.osamA
09-08-2011, 05:48 AM
installed
thank you bro

Gio~Logist
09-10-2011, 07:52 AM
It?s working in my forum oK!! =)

But I?ve a problem when I do clic in the photo, it happen two things:
-Open new windows with image
+
-In the same window show preview image...


Not sure exactly what you mean, you've lost me. Can you send me a pm perhaps?


Anyone have an example of this running?

I can try and get you a demo if need be, but it pretty much just resizes the image and takes you to the big version if you click it. Nothing fancy, just straight to the point really.

socialteenz
09-11-2011, 05:50 PM
Anyone have an example of this running?

Here (http://eminemtalk.com/threads/17-List-of-All-Eminem-Albums-With-their-Achievements-amp-Awards!?p=45&viewfull=1#post45)

Gio~Logist
09-11-2011, 10:09 PM
Here (http://eminemtalk.com/threads/17-List-of-All-Eminem-Albums-With-their-Achievements-amp-Awards!?p=45&viewfull=1#post45)

Thanks ; )

Quest2be1
09-15-2011, 01:53 AM
Hey Gio, I wanted to ask you one more thing. Is there a line I can remove from your xml file so that your plug-in will only work for signatures? I don't know if being able to set a limit for posts and then a separate limit for sigs is still keeping it lite, but if so that would be cool.

Example...
I might want pictures in user's post to be able to go up to 700px wide.
Yet, for sigs I might only want it set to 400px wide.
As of right now I have it set to 550 to meet in between and I don't like it lol.

rcsparks
09-16-2011, 01:05 AM
Works well with 4.1.1 .. Just an FYI.. and THANKS!!

ZelleZ
09-16-2011, 09:23 PM
<i>Install
1. Import Product
2. Set a Maximum Width in Admincp, under Quick Auto Image-Resize (Posts & Signature)
</i>

I downloaded it but not sure how to import it, and 2) where do I set the Maximum Width. Where do I find that in the Admincp?

Thanks!

DNN
09-25-2011, 12:28 AM
does this mod also resize video that are inside of forum posts?

Gio~Logist
09-28-2011, 08:53 PM
Install
1. Import Product
2. Set a Maximum Width in Admincp, under Quick Auto Image-Resize (Posts & Signature)


I downloaded it but not sure how to import it, and 2) where do I set the Maximum Width. Where do I find that in the Admincp?

Thanks!

vB Settings

Gio~Logist
09-28-2011, 08:53 PM
does this mod also resize video that are inside of forum posts?

Not at the moment. That might be a good idea, only all videos are embed differently. Especially when you take everyone's diff video bb tags into perspective.

Gio~Logist
09-28-2011, 08:54 PM
Hey Gio, I wanted to ask you one more thing. Is there a line I can remove from your xml file so that your plug-in will only work for signatures? I don't know if being able to set a limit for posts and then a separate limit for sigs is still keeping it lite, but if so that would be cool.

Example...
I might want pictures in user's post to be able to go up to 700px wide.
Yet, for sigs I might only want it set to 400px wide.
As of right now I have it set to 550 to meet in between and I don't like it lol.

You would have to rename the variables and split up the file.

thecore762
09-28-2011, 11:33 PM
tagged

synseal
10-19-2011, 06:22 PM
Exactly what I wanted 5 stars *installed

Thank you.

Sworm
12-12-2011, 09:17 PM
Hi Gio :), great work :) ... to resize images, i'm actually using this add at the end of my style postbit.css (Zer query)...:
/* BEGIN Image resize */
#posts IMG {
max-width: 640px;

}
#collapseobj_threadreview IMG {
max-width: 640px;

}
/* END Image resize */ It is better to use this one or your one? thanks

depalaza
01-02-2012, 12:30 PM
nice one but it's didn't work for gif file format

snerd
01-09-2012, 04:23 PM
I've been using this from the 3.xx vBulletin mod section for over a year. How did I miss it over here in the 4.xx section?! LOL!

Great, simple mod that does the job it's designed for.

gamaken
01-26-2012, 10:55 PM
I don't know if this is a bug or expected, but this mod is giving certain graphics the onclick javascript.
Smileys, the quote icon...they become clickable links opening a new page/tab and show the graphic. Any fix for this because we like the mod a lot.

motorhaven
02-13-2012, 09:37 AM
I don't know if this is a bug or expected, but this mod is giving certain graphics the onclick javascript.
Smileys, the quote icon...they become clickable links opening a new page/tab and show the graphic. Any fix for this because we like the mod a lot.

Found the same bug. Change this in the plug-in:

$post['message'] = str_replace('<img', '<img style="max-width: ' . $this->registry->options['gquick_autoresize_maxwidth'] . 'px; cursor: pointer;" onclick="window.open(this.src)" ', $post['message']);
$post['signature'] = str_replace('<img', '<img style="max-width: ' . $this->registry->options['gquick_autoresize_maxwidth'] . 'px; cursor: pointer;" onclick="window.open(this.src)" ', $post['signature']);

to this:

$post['message'] = str_replace('<img', '<img style="max-width: ' . $this->registry->options['gquick_autoresize_maxwidth'] . 'px; cursor: pointer;" onclick="window.open(this.src)" ', $post['message']);
$post['message'] = str_replace('onclick="window.open(this.src)" class="inlineimg" src="images/buttons/', 'class="inlineimg" src="images/buttons/', $post['message']);
$post['message'] = str_replace('onclick="window.open(this.src)" src="images/smilies', 'src="images/smilies/', $post['message']);
$post['signature'] = str_replace('<img', '<img style="max-width: ' . $this->registry->options['gquick_autoresize_maxwidth'] . 'px;
cursor: pointer;" onclick="window.open(this.src)" ', $post['signature']);

Not the most efficient way but its 4:30 in the morning, I'm groggy and just wrote it.

AndrewRich
04-19-2012, 09:05 PM
Here is a version with the following modifications:


applies to signatures only
doesn't apply to smilies (motorhaven's fix above)

Mr GRiM
08-26-2012, 02:09 PM
Any chance of one that only does the attachments and images in posts excluding the sigs lol

powerwheelie
09-10-2012, 01:42 PM
Awesome mod!

gamaken
01-16-2013, 07:32 PM
I have a quick fix for preventing all post (and/or sig) images opening in new tabs.
Change:
$post['message'] = str_replace('<img', '<img style="max-width: ' . $this->registry->options['gquick_autoresize_maxwidth'] . 'px; cursor: pointer;" onclick="window.open(this.src)" ', $post['message']);
To:
$post['message'] = str_replace('<img', '<img style="max-width: ' . $this->registry->options['gquick_autoresize_maxwidth'] . 'px; " ', $post['message']);
For signatures....
Change:
$post['signature'] = str_replace('<img', '<img style="max-width: ' . $this->registry->options['gquick_autoresize_maxwidth'] . 'px; cursor: pointer;" onclick="window.open(this.src)" ', $post['signature']);
To:
$post['signature'] = str_replace('<img', '<img style="max-width: ' . $this->registry->options['gquick_autoresize_maxwidth'] . 'px; " ', $post['signature']);
That fixes the problem, but in order to see a full size image you have to middle mouse or right-click to open, which for me was a good trade-off.

Gio~Logist
03-19-2013, 11:16 AM
Awesome mod!

:up::up:

Replicators
03-24-2013, 04:26 PM
Does this also work for images in cms articles?

EDIT: No it doesn't, could you also work on a seperate addon which would do cms and blog's aswell?

kylek
08-19-2013, 01:27 AM
Anyone figure out a way to have it say something like click to view full size?

uspatriot00
02-24-2015, 12:52 AM
Can anyone explain barney style on how to install this mod?