Forum

Results 1 to 10 of 10
  1. #1
    Join Date
    December 2009
    Location
    Germany
    Posts
    105

    How to generate avatar file name?

    Hello,

    uploaded avatars are saved on the server in a special folder. For example in teamspeak3-server_linux-amd64/files/virtualserver_6/internal. Every avatar file begins with avatar_. Example for an avatar file name: avatar_pfdonclddinodpgdfpelhhnppongjcjfelfhcoio

    My database is mysql.

    Exists any possibility to generate the name of the avatar file to an user?

    My problem: I have written a website in php which displays all data of all clients. I want to display the avatar to every client. Exists any possibility to get the name of the avatar file?

    In database in table client_properties I only found a value for client_flag_avatar but this value is not equal with the name of the avatar file.

    Can anyone help me, please?

    Best regards
    Ronald
    Last edited by Ronald; July 13th, 2010 at 10:03 PM.

  2. #2
    Join Date
    May 2010
    Posts
    6,310
    Hello

    On your website you can use the socket function and the specific query command.

    Read all FT permissions in the documentation :
    TeamSpeak 3 Server Query Manual.pdf

  3. #3
    Join Date
    December 2009
    Location
    Germany
    Posts
    105
    Hello florian,

    thanks for you answer.

    With server query I get the value for the client_flag_avatar which I also get from database.

    With ftinitdownload I can initialize a download for a file which is saved in a channel. Can I also initialize downloads for avatars with this command? When I use the client_flag_avatar value as name I always get the error message "invalid file path".

    I prefer a solution which gets me the file name for the avatar. As a start it solves my problem if I can get the avatar with server query.

  4. #4
    Join Date
    May 2010
    Posts
    6,310
    I will write a PHP code that will help you (this is not a solution because every site is different but an axis of reflection)

    PHP Code:
    if(!$socket Connect($ip$qport)) // Function to connect on query port
    {
            die(
    "Socket error");
    }

    com_ss_data($socket"login serveradmin florian"); // function to log on serveradmin


    if(!$verif com_ss_data($socket"use 1"))  // Server selection
    {
            die(
    "Error on selection");
    }

    // Now we get a file list 
    $filelist com_av_dap($socket"ftgetfilelist cid=0 cpw='' path=\/");
    print_r($filelist);
    echo 
    "<p>";

    foreach(
    $filelist as $key=>$value)
    {
         if(
    substr($value['name'], 07)=='avatar_')
         {
              echo 
    $value['name']."<p>";
              
    $file "\/".$value['name'];
        
              
    $getfile com_av_data($socket"ftinitdownload clientftfid=".rand(1,99)." cid=0 cpw='' name=".$fichier." seekpos=0");
        
              
    // Now go to download the file        
              
    $sock_file=fsockopen("tcp://192.168.1.98"$getfile['port'], $errnum$errstr10);
              
    fputs($sock_file$getfile['ftkey']);
              
    $data='';
              while (!
    feof($sock_file)) 
              {
                   
    $data.= fgets($sock_file4096);
              }
            
              
    $save fopen($value['name'], "w+");
              
    fwrite($save$data);
              
    fclose($file);    
            
         }

    After that you have in your website folder the user avatar. You can use the Psychokiller's dev to display the avatar file.

    Just for your understanding :
    Connect : use fsockopen
    com_ss_data : this function send query command and no return information
    com_av_data : this function send query command with simple informations in return
    com_av_dap : this function send query command with piped informations in return

  5. #5
    Join Date
    December 2009
    Location
    Germany
    Posts
    105
    You are right. With commands ftgetfilelist and ftinitdownload it is possible to download avatars.

    My problem is I want to display the avatar to every client. I need a mapping from client to avatar name.

    Reading or downloading avatar files is not my problem. But after downloading I don't know which avatar belongs to which client.

  6. #6
    Join Date
    May 2010
    Posts
    6,310
    Ok you search the correspondence between the client_flag_avatar and the file in the server folder.

    So with clientinfo clid=... you obtain the list of properties of this client.

    The propertie that interest you is not client_flag_avatar but client_base64HashClientUID. This proportie show you the name of the avatar. You add "avatar_" in front, and you have the name of the file in server folder

  7. #7
    Join Date
    December 2009
    Location
    Germany
    Posts
    105
    That is it.

    Thanks a lot!

    Now the ultimative question: Can I generate this value manually?

    Reason: clientinfo only works for online clients. I want have the avatars also to offline clients. With clientdblist I get the unique IDs of clients.

  8. #8
    Join Date
    May 2010
    Posts
    6,310
    No. We don't have the method for the avatar (for icon it's crc32 checksum).

    For this moment I don't make a test on code and hash.
    You can make a php bot that recording the avatar code in an other database

  9. #9
    Join Date
    December 2009
    Location
    Germany
    Posts
    105
    Ok, than I will save client_id and client_base64HashClientUID in an extra table if anyone sets an avatar.

    Maybe some day exists a possibility to get avatar names for offline clients...

    Thank you very much for your help.
    Last edited by Ronald; July 14th, 2010 at 03:23 PM.

  10. #10
    Join Date
    May 2010
    Posts
    6,310
    your welcome
    Last edited by florian_fr40; October 25th, 2011 at 02:22 PM.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Replies: 2
    Last Post: February 20th, 2013, 03:24 PM
  2. avatar's and File transfers don't work?
    By DownClick in forum Server Support
    Replies: 2
    Last Post: November 16th, 2011, 07:18 AM
  3. How is avatar mapped to file?
    By Barungar in forum Server Support
    Replies: 1
    Last Post: May 25th, 2011, 12:14 PM
  4. [Solved] Avatar, Max file size not more than 0 kb?
    By Octopus09 in forum General Questions
    Replies: 4
    Last Post: April 13th, 2010, 06:08 PM
  5. File Transfer - avatar Problems
    By Xenotrom in forum General Questions
    Replies: 2
    Last Post: December 22nd, 2009, 12:49 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •