vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 3.5 Add-ons (https://vborg.vbsupport.ru/forumdisplay.php?f=113)
-   -   Proportionally Auto Resize User Avatar (https://vborg.vbsupport.ru/showthread.php?t=113306)

toolblast 04-17-2006 10:00 PM

Proportionally Auto Resize User Avatar
 
PROPORTIONALLY AUTO RESIZE USER AVATAR PLUGIN

Last updated: April 18th - newest file is 'PluginFiles.zip'

What does this plugin do?
It will allow you to place the logged in user's avatar in your forum header or navbar and then set a predefined maximum width and height that the user's avatar can go in. Then, using PHP, an automatic resize will occur that will NOT stretch the image.

Update: this hack doesn't work everywhere like previously stated in earlier versions. Some templates in vbulletin do not render global variables making the plugin not show the avatar. One of these templates is the postbit template. If you put '$useravatar' in that template nothing will happen. Why? I'm not sure, and if anyone knows how to make it work please share!

What is the point of this plugin?
If you want the user to be able to upload a large avatar that will appear on the postbit, but in the forum login info part in the header you want to show their avatar, but at a smaller size than the original (without editing the original uploaded file and without stretching it). This is for you.

Installation:
Extremely simple. Simply upload plugin from the plugin manager area of your VBulletin Admin (for those who don't know, go to Plugin System > Download/Upload Plugin > Browse for the file and upload it). Then, you simply upload the imageresize.php file into your main forum folder.

Instructions:
To place the user's avatar in the template, edit one of your vbtemplates (header template preferrably), and then insert this code where you want the image to appear:

Quote:

$useravatar
If you want their avatar to link to their profile insert:
Quote:

<a href="$vboptions[bburl]/profile.php?do=editavatar">$useravatar</a>
To change the max height and width dimentions for the avatar, edit the plugin and change the following line of code:

Quote:

//SET MAX RESTRAINTS
$maxheight=40;
$maxwidth=50;
Note: Upload both photoresize.php and noavatar.gif to your forum HOME directory. You can change the noavatar.gif image to whatever you want. Make sure you have your vbulletin homepage url set in your general vbulletin options area otherwise the script wont know the url of your forum!


Credits:
The "Avatar in Navbar" plugin by sabret00the [click here]
NPL Solution's script from Webmaster-Talk [click here]
DONT FORGET TO CLICK INSTALL! :cool:

toolblast 04-18-2006 04:03 AM

The FILE HAS BEEN UPDATED April 18th.

It is now easier to edit the constraints proportions, they are 2 variables at the very top of the plugin code that you can easily edit via the plugin manager.

Supports pre-defined avatars from your vbulletin collection, custom uploaded avatars, as well as can put an image in place of an avatar if the user has not yet specified one.

UPDATE: Two new screenshots added.

UPDATE: Support for both IE and FIREFOX added.

Kihon Kata 04-18-2006 06:15 AM

woot, I'll check this out very soon

First post!

G-Force 199 04-18-2006 02:11 PM

Installed.
But could you zip all the files ? Thank anyway.

The Chief 04-18-2006 02:19 PM

this looks good, I will maybe try it out today :)

Kihon Kata 04-18-2006 02:58 PM

COOL! INSTALLED! One problem, it didn't work! ;)

I installed this and all it did was put the text "Your Avatar" with a link to http://www.YOURSITENAME.com/forums/p...?do=editavatar

I tried to put it in a few different templates also.

toolblast 04-18-2006 11:19 PM

Hi Kihon and others! Thanks for installing and testing.

I quickly uploaded this plugin last night as I finally got it working on my forum. However, there are a few bugs in the code which I am fixing right now.

Expect an updated zip file within an hour or so! Thanks.

toolblast 04-19-2006 01:22 AM

Quote:

Originally Posted by G-Force 199
Installed.
But could you zip all the files ? Thank anyway.

Zipped. Done.

toolblast 04-19-2006 01:24 AM

Quote:

Originally Posted by Kihon Kata
COOL! INSTALLED! One problem, it didn't work! ;)

I installed this and all it did was put the text "Your Avatar" with a link to http://www.YOURSITENAME.com/forums/p...?do=editavatar

I tried to put it in a few different templates also.


It is showing 'yoursitename' and the avatar image is not working because you have not defined your website URL in your general Vbulletin settings. Do that and it should work fine.

Kihon Kata 04-19-2006 01:40 AM

Quote:

Originally Posted by toolblast
It is showing 'yoursitename' and the avatar image is not working because you have not defined your website URL in your general Vbulletin settings. Do that and it should work fine.

HI Tool! Uhm do you mean my "Internal URLs"?

And did you update it?

toolblast 04-19-2006 01:42 AM

Quote:

Originally Posted by Kihon Kata
HI Tool! Uhm do you mean my "Internal URLs"?

The script uses the variable you have set in your vbulletin settings.

Go to your vbulletin admincp and tell me what you find here:

VBULLETIN OPTIONS > VBULLETIN OPTIONS > SITE NAME / URL / CONTACT DETAILS >> The variable called "FORUM URL" (2nd input box).

You should have the url to your forum in there with no trailing slash.

Kihon Kata 04-19-2006 01:44 AM

I have that filled up with "http://www.MYSITENAME.com/forums" with no quotes and my real forum name.

toolblast 04-19-2006 01:47 AM

Ok, and tell me:

1) Try putting the avatar code into the header template of your forum.

2) Then, login to your forum and make sure you have an avatar selected for the username you logged in with.

3) Make sure you've downloaded and are using the recent files I put in the zip file attached here.

It should work fine if you're using VB3.5. There must be a setting somewhere that is not set correctly on your forum if it doesnt work. I can show you a demo forum with this running if you'd like.

Kihon Kata 04-19-2006 01:51 AM

I did the top 2 already. Did you update #3 today?

EDIT: I am using 3.5.4

toolblast 04-19-2006 01:51 AM

Hi Kihon,

I just did some checking and I see the problem you are seeing now. It only seems to happen in FireFox. If you use IE the plugin works fine.

I wonder why it doesnt work in firefox. I'll look into it.

toolblast 04-19-2006 01:52 AM

Quote:

Originally Posted by Kihon Kata
I did the top 2 already. Did you update #3 today?

EDIT: I am using 3.5.4


Yes. I just uploaded a new zip file. It seems that the image isnt displaying in firefox (though its common php thats creating the image, so Im not sure sure why).

Kihon Kata 04-19-2006 01:55 AM

Oh ok, even though I have a busy forum with 99.99% women, many many use Firefox. I'll wait until you update it w/ firefox. :-)

toolblast 04-19-2006 01:57 AM

Hi Kihon.

Ok, I have gotten it to work with FireFox now. I will upload a new zip file to this thread in about 4 minutes and it will be called 'PluginFiles.zip' ok?

Kihon Kata 04-19-2006 02:04 AM

woot! nice support toolblast! update the version and I'll reinstall it

toolblast 04-19-2006 02:18 AM

Ok Kihon. It should be all done.

Works in both Firefox and IE6. Ive checked both. Also, i've included an image called 'noavatar.jpg' which will show up if the user has no avatar.

Tell me if you have any problems!

toolblast 04-19-2006 02:25 AM

Don't forget, the variable is now '$useravatar' if you just downloaded the latest zip file (which I uploaded a second ago). Then $useravatar is the variable you can use in any template to show your resized avatar of the current logged in user.

Kihon Kata 04-19-2006 04:20 AM

Quote:

Originally Posted by toolblast
Don't forget, the variable is now '$useravatar' if you just downloaded the latest zip file (which I uploaded a second ago). Then $useravatar is the variable you can use in any template to show your resized avatar of the current logged in user.

I'll try this in a few and report back soon, but what if I already use the "no avatar selected" hack?

Kihon Kata 04-19-2006 04:36 AM

Quote:

Originally Posted by Kihon Kata
I'll try this in a few and report back soon, but what if I already use the "no avatar selected" hack?

Ok, this STILL isn't working for me.

I uploaded the php file into the forum root, imported the plugin in the acp and I than went to my header template and addedd:
  • <a href="$vboptions[bburl]/profile.php?do=editavatar">$useravatar
    </a>
  • I also try to add just "$useravatar"
Internet Explorer is showing a RED X as my avatar and Firefox shows nothing


WHo knows.

toolblast 04-19-2006 04:53 AM

Ok, right-click on the red x'd image and look at the properties of the image. Copy and paste that into this thread. Thanks :)

As for the 'no avatar image' hack, I'm not sure exactly what will happen because I dont have it installed on my test board. I would assume that the no avatar image hack either a) gives all users a default avatar, so they have an avatar at all times, just the one they get is your default one. This case, this plugin would just shrink and display the default avatar. b) it dynamically places a 'noavatar' image everywhere that the user's avatar is displayed and dynamically does it. Thus, the user sees 'do not use avatar' checked off in their usercp, but it shows the default image anyways. In this case Im not sure what would happen.

Is the 'no avatar image' hack, that is separate to this one, a plugin? If so, try turning that plugin off and seeing if this one works.

Kihon Kata 04-19-2006 05:04 AM

RED X url:
Code:

http://www.MYSITEHERE.com/forums/imageresize.php?image_name=http://www.MYSITEHERE.com/forums/image.php?u=4&dateline=1139443346&image_height=40&image_width=50
yes, the default avatar is a plugin

toolblast 04-19-2006 05:50 PM

Check with your host, you might not have the GD graphics library enabled on your server. Maybe if you want i'll put together a php file that will do a test to see if you have the requirements that php needs to generate the thumbnail.

Kihon Kata 04-19-2006 08:21 PM

Quote:

Originally Posted by toolblast
Check with your host, you might not have the GD graphics library enabled on your server. Maybe if you want i'll put together a php file that will do a test to see if you have the requirements that php needs to generate the thumbnail.

lol, I am my own host LOL. I run my own decidated webserver in a datacenter in NYC.

Running Linux Fedora ...this server also has GD 2 installed

toolblast 04-19-2006 09:43 PM

Hmm. Well Kihon, I really dont know what to say lol. If you're running vb 3.5.4 and you're logged in as a user who has uploaded a custom avatar, and you are still seeing an X or nothing in firefox, then something is setup incorrectly on your server or your vbulletin forum.

If you'd like i'll PM you the URL to a test board I have running the plugin with nothing else installed and it works just fine.

Have you tried taking off the 'default avatar' hack you had installed?

Kihon Kata 04-19-2006 10:24 PM

Yep, running a pretty successfull 3.5.4 with almost 400,000 posts :)

What if I let you come in as an admin and you can fool with it? PM me if interested

cannabis-world 04-24-2006 02:21 AM

hi toolblast, do you know how I might use the imageresize.php to remove exif data from attachments as they are uploaded. I was told that if I can reduce the uploaded files color depth that it would remove the exif data. I was also told that if I resize it was also remove exif data, but I don't really want to resize attachments.
thanks for your time

toolblast 04-24-2006 04:02 AM

Hi Cannabis,

Why do you need exif data removed, may I ask? There may be another solution.

cannabis-world 04-24-2006 11:00 PM

the users have specifically requested that exif data get dropped for their personal security (cannabis gardeners), also it will help reduce the bandwidth, overhead etc.

thank you for looking into this matter, much appreciated!!

toolblast 04-25-2006 01:24 AM

The only way I see that being done would be to recreate the image (thus taking away the tags from the previous authorship). Using this script you could do that. All you need to do is use the imageresize.php script and make the maximum dimentions HUGE like 99999. That way the image they do upload will not need to be resized. Once you've done that, php will recreate the image and it wont lose any quality (at least it shouldnt). Tell me how that goes. Goodluck.

fneumeier 04-25-2006 03:13 AM

My original question was: Where in the code is the place to do this. And, hey, I really want to reduce the size of the images!

Any idea where in the code ist the place to do this? I just couldn't find the place where the images are being handled when/after uploaded by the user.

Thanks!
Franz

cannabis-world 04-27-2006 01:42 PM

I'm kinda in the same boat, due to my lack of php skills I'm not sure where to put the include, but I figured out it would go in the includes/class_upload.php somewhere

yellowchaser 04-27-2006 04:20 PM

How can this be used in the postbit so that all users avatars can be made a consistent size within the forums? What code and where would need to be replaced to make this work? I would assume the post_bit but not sure.

rmxs 04-27-2006 05:59 PM

very good nice job :)

toolblast 04-27-2006 06:48 PM

Quote:

Originally Posted by fneumeier
My original question was: Where in the code is the place to do this. And, hey, I really want to reduce the size of the images!

Any idea where in the code ist the place to do this? I just couldn't find the place where the images are being handled when/after uploaded by the user.

Thanks!
Franz


What are you wanting to resize... ALL images that your users upload in their forum posts? So, it would be in the postbit where the forum displays the images attached to the post?



Quote:

I'm kinda in the same boat, due to my lack of php skills I'm not sure where to put the include, but I figured out it would go in the includes/class_upload.php somewhere
Im not exactly sure what you are doing here, what are you putting the include code in your upload script? This script dynamically resizes the images on OUTPUT, not when saving the image. So, the image that is uploaded by the user is uploaded normally, this script would kick in where that uploaded image is meant to be DISPLAYED, the script would take the original uploaded image, resize it, and then output the new one all in realtime without saving a new jpg file.

toolblast 04-27-2006 06:52 PM

Quote:

Originally Posted by yellowchaser
How can this be used in the postbit so that all users avatars can be made a consistent size within the forums? What code and where would need to be replaced to make this work? I would assume the post_bit but not sure.

You will need to go into the postbit template via the VBulletin AdminCP template editor. Once you're in the postbit template (postbit templates > postbit), find where it outputs the user's avatar:

Code:

                          <if condition="$show['avatar']">&nbsp;<br /><a href="member.php?$session[sessionurl]u=$post[userid]"><img src="$post[avatarurl]" alt="<phrase 1=" $post[username]">$vbphrase[xs_avatar]</phrase>" border="0" /></a></if>
And replace it with:

Code:

                          <if condition="$show['avatar']">&nbsp;<br /><a href="member.php?$session[sessionurl]u=$post[userid]">$useravatar</a></if>
P.S. And thanks rmxs for the thank-you ;)

fneumeier 04-28-2006 03:20 AM

Quote:

Originally Posted by toolblast
What are you wanting to resize... ALL images that your users upload in their forum posts? So, it would be in the postbit where the forum displays the images attached to the post?

Chad,

I've read such suggestions now many time here in various forums. But this definitely it not a solution but only is a desaster for performance on my server. Imaging users upload a 3-Mpixel image and VB is resizing this EVERY TIME this image is being viewed! Also, think about storage space these pictures would need on the server/in the database!

No, I really want to resize the images right when they're uploaded. In consider this as extremely userfriendly (no need fo the user to resize the images prior to upload) and as a optimal solutions for server performance and storage space. The high resolution/big sized images are not needed for anything, so why keep them on the server?

Have you got an idea where to resize the pictures right at the upload?

Thanks
Franz


All times are GMT. The time now is 11:44 AM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01548 seconds
  • Memory Usage 1,841KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (3)bbcode_code_printable
  • (15)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (40)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.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/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.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
  • printthread_start
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete