1
ccrstudioweb
Only one avatar by user, always with the same file name

Hi All,
I need to customize my XOOPS and I need your help. I want that when user upload a new avatar, it subscribes the former.

To do that, it needs to have the same name on uploads/ dir.

I was thinking in use username.jpg instead of cavt49132c02305ea.jpg

What should I change on editusers.php?
My Google Maps API3 and Xoops integration (Cool!):
http://www.esterecomendo.com.br/portal/

2
ghia
Re: Only one avatar by user, always with the same file name
  • 2008/11/14 17:52

  • ghia

  • Community Support Member

  • Posts: 4953

  • Since: 2008/7/3 1


Quote:
I want that when user upload a new avatar, it subscribes the former.
And why do you need that?

3
ccrstudioweb
Re: Only one avatar by user, always with the same file name

It is on class/uploader.php line 350:

if (isset($this->targetFileName)) {
$this->savedFileName = $this->targetFileName;
} elseif (isset($this->prefix)) {
$this->savedFileName = ($this->prefix).'XXX'.($member_handler).'.'.strtolower($matched[1]);


The file I get on uploads is:
cavtXXX.jpg


Does anybody know hou to put usr name in place in red?
My Google Maps API3 and Xoops integration (Cool!):
http://www.esterecomendo.com.br/portal/

4
ccrstudioweb
Re: Only one avatar by user, always with the same file name

Hi,
Because I want avatar to appear in a flash application. The application can't change avatar's name when user changes it, because XOOPS save avatar using a diferent name (cavtfdud8273rb873rb.jpg). So if I have the cavtusername.jpg, flash application will be able to call avatar image trought it's XML file.


I'd tried
$this->savedFileName = ($this->prefix).'XXX'.$xoops_uname.'.'.strtolower($matched[1]);

I still have cavtXXX.jpg.
The image is subscribed, but all users's avatars will be saved using this same name.
I need put user_name om it.
My Google Maps API3 and Xoops integration (Cool!):
http://www.esterecomendo.com.br/portal/

5
ghia
Re: Only one avatar by user, always with the same file name
  • 2008/11/14 19:20

  • ghia

  • Community Support Member

  • Posts: 4953

  • Since: 2008/7/3 1


And how do your Flash application know it is user xxx or yyy and need to display cavtXXX.jpg or cavtYYY.jpg?
I think in the same way you pass the users name, you can pass to the Flash application the users avatar location too.

6
ccrstudioweb
Re: Only one avatar by user, always with the same file name

I feed it manually.
On exemple above (if works) wuould give me:

cavtXXXusername.jpg



the XXX I will change it to underline (_):
cavt_username.jpg

LOOK:
$this->savedFileName = ($this->prefix).'_'.$xoops_uname.'.'.strtolower($matched[1]);

My Google Maps API3 and Xoops integration (Cool!):
http://www.esterecomendo.com.br/portal/

7
ccrstudioweb
Re: Only one avatar by user, always with the same file name

I've got it!!

In edituser.php:
change:
$uploader->setPrefix(cavt');

$uploader->setPrefix('cavt');
$uploader->setPrefixb($xoopsUser->getVar('uname'));

On class/uploader.php:
1)Change:
var $prefix;
For:
var $prefix;
var $prefixb;

2)Change:
function setPrefix($value){
$this->prefix = strval(trim($value));
}



For:
function setPrefix($value){
$this->prefix = strval(trim($value));
}

function setPrefixb($value){
$this->prefixb = strval(trim($value));
}


3)Change the following line from:

elseif (isset($this->prefix)) {
$this->savedFileName = uniqid($this->prefix).'.'.strtolower($matched[1]);


To:
} elseif (isset($this->prefix)) {
$this->savedFileName = ($this->prefix).''.($this->prefixb).'.'.strtolower($matched[1]);
My Google Maps API3 and Xoops integration (Cool!):
http://www.esterecomendo.com.br/portal/

8
ccrstudioweb
Re: Only one avatar by user, always with the same file name

This solution give me the option to subscribe only one image, in this case the avatar. I ask: Is there any image module in which I may set up the "subscription image" option, or easiely set up it on its code?

I mean I want site's user to have more tha one image to be subscribed on server.

For instance:
site_user0001_01.jpg
site_user0001_02.jpg
site_user0001_03.jpg
site_user0001_04.jpg
site_user0001_05.jpg
site_user0002_01.jpg
site_user0002_02.jpg
site_user0003_03.jpg
site_user0004_04.jpg
site_user0005_05.jpg
.
.
.

Any help or suggestion? Thanx in advance!

My Google Maps API3 and Xoops integration (Cool!):
http://www.esterecomendo.com.br/portal/

9
ghia
Re: Only one avatar by user, always with the same file name
  • 2008/11/16 23:05

  • ghia

  • Community Support Member

  • Posts: 4953

  • Since: 2008/7/3 1


So, you don't want a static avatarname, but a users photo album.
XcGal allows pictures upload from users in users albums.
Other possibilities are profile modules as Userinfo or Clientspace and social modules as Yoghurt.

Login

Who's Online

207 user(s) are online (134 user(s) are browsing Support Forums)


Members: 0


Guests: 207


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: May 31
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits