View Full Version : Uniform avatar dimensions
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 if ($imginfo=@getimagesize($filename)) {
if ($imginfo[0]>$avatarmaxdimension or $imginfo[1]>$avatarmaxdimension) {
... etc.... (using the first two array elements as X 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:
if ($post[avatarid]!=0) {
$avatarurl=$post[avatarpath];
} else {
and replace that with this:
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
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...
vBulletin® v3.8.12 by vBS, Copyright ©2000-2025, vBulletin Solutions Inc.