vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 General Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=111)
-   -   Uniform avatar dimensions (https://vborg.vbsupport.ru/showthread.php?t=35322)

Jawelin 02-22-2002 12:26 PM

Hi. I installed most of avatar-related hacks and uploaded many many avatars (categorized) to my board.
Most of them are animated gif, very nice.
Well, now I would make them displayed uniformly, i.e. some are larger than others.
I saw the 50 pixel affects only the uploaded avatar dimension, but I would resize all the images larger than 50px to that limit, without deforming them

Is there any hack or other way to limit everywhere the size of those avatars ?

Thanks a lot.
Bye

Jawelin 02-26-2002 12:01 PM

I though to modify the avatar-related templates calculating in the calling phps the scaled dimensions to my limits.
Does anybody have a trick or at least could tell me if it's a comprehensive method ?
Thnx

Admin 02-26-2002 12:03 PM

Use getimagesize():
http://www.php.net/manual/en/function.getimagesize.php

Jawelin 02-26-2002 02:46 PM

Yes, thanks. Of course.
As the dim check is done everywhere in vb code
PHP Code:

        if ($imginfo=@getimagesize($filename)) {
          if (
$imginfo[0]>$avatarmaxdimension or $imginfo[1]>$avatarmaxdimension) {
... 
etc.... (using the first two array elements as and Y dims

I would know if I should make the rescale everywhere in code (I found about 14 templates and many phps) or - in a cleaner way - create a function for the whole "< img src = .... width= height= >" string and put that variable into templates and admin php code (which doesn't use templates...) ?

Or, at least, resize by hand all my avatars with PhotoShop or similar, as the uploaded custom avatars have the dimension size limit at code level ???
:stupid:


P.S.: do you know why uploaded avatars aren't deleted in my server's temp dir ? (Linux, safe mode)

Thanks

Admin 02-26-2002 03:35 PM

Add a check in getpostbit() that checks, if the user is using an avatar from your stock, the site of the image, then $imageinfo[3] in the <img> tag.

Because I'm nice (read: bored ;)), find this in functions.php:
Code:

                if ($post[avatarid]!=0) {
                        $avatarurl=$post[avatarpath];
                } else {

and replace that with this:
Code:

                if ($post[avatarid]!=0) {
                        $avatarurl=$post[avatarpath];
                        $imginfo = getimagesize('/path/to/your/images/folder/' . $avatarurl);
                        if ($imginfo[0]>50) {
                                $moreimgtag = 'width="50"';
                        }
                        if ($imginfo[1]>50) {
                                $moreimgtag .= 'height="50"';
                        }
                } else {
                        $moreimgtag = '';

and now add $moreimgtag to your postbit_avatar template.

Jawelin 02-26-2002 04:23 PM

Quote:

Originally posted by FireFly
[...]
Because I'm nice (read: bored ;)), [...]

You're absolutely right ! .... Nice
(couldn't say 'bored', my side...)
:D
Thanks

P.S. 1: of course, you wouldn't get upset if I'd rescale proportionally sizes and post here my solution ?

P.S. 2: I should make the same-kind replacement also in announcement, private and elsewhere used avatars... ;)

Thanks again.
Bye

Admin 02-26-2002 04:41 PM

P.S. 1, no I don't mind, and I'd love if you could post this.

P.S. 2, that's correct.

BTW did you even test my code? I don't think it'll work right away anyway...


All times are GMT. The time now is 09:09 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.02845 seconds
  • Memory Usage 1,736KB
  • 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
  • (2)bbcode_code_printable
  • (1)bbcode_php_printable
  • (1)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (7)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
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete