upload avatar in wapdesire v2 please help

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    upload avatar in wapdesire v2 please help

    the script needs to wapdesire 2 so that I can upload an avatar, and automatically sets the profile kobinowalem in the gallery but do not go ask for help and sorry for my english

    #2
    usage
    Code:
    echo "<a href=\"lists.php?action=upavat&amp;sid=$sid\">»Upload Avatar</a><br/>";
    genproc.php
    Code:
    /////////////////Upload avatar////////////////////////
    
    
    else if($action=="upavat"){
    
    addonline(getuid_sid($sid),"Uploading avatar image","");
    
    $size = $_FILES['attach']['size']/1024;
    
    $origname = $_FILES['attach']['name'];
    
    $res = false;
    
    $ext = explode(".", strrev($origname));
    
    switch(strtolower($ext[0])){
    
            case "gpj":
    
        $res = true;
    
        break;
    
        case "gepj":
    
        $res = true;
    
        break;
    
    }
    
    $tm = time();
    
    $uploaddir = "./avatars";
    
    if($size>512){
    
        echo "File is larger than 512KB";
    
        
    
    }
    
    else if ($res!=true){
    
                                        
    
        echo "File type not supported! Please attach only a JPG/JPEG.";
    
    }
    
    
    
    else{
    
        $name = getuid_sid($sid);
    
        $uploadfile = $name.".".$ext;
    
        $uppath=$uploaddir."/".$uploadfile;
    
        move_uploaded_file($_FILES['attach']['tmp_name'], $uppath);
    
        $filewa=$uppath;
    
        list($width, $height, $type, $attr) = getimagesize($filewa);
    
        $newname=$uploaddir."/".$name."u.jpg";
    
        $newheight = ($height*128)/$width;
    
        $newimg=imagecreatetruecolor(128, $newheight);
    
        $largeimg=imagecreatefromjpeg($filewa);
    
        imagecopyresampled($newimg, $largeimg, 0, 0, 0, 0, 128, $newheight, $width, $height);
    
        imagejpeg($newimg, $newname);
    
        imagedestroy($newimg);
    
        imagedestroy($largeimg);
    
        $file1=$name."u.jpg";
    
        unlink($filewa);
    
            $res1 = mysql_query("UPDATE ibwf_users SET avatar='./avatars/$file1' WHERE id='".$name."'");
    
    }
    
    if($res1){
    
        echo "Your file $origname was successfully uploaded and set to your profile!";
    
    }
    
    else {
    
        echo "File couldn't be processed! Check error messages and report to a moderator or admin if applicable.";
    
    }
    
    
    
    }
    list.php
    Code:
    ///////////////Upload avatar///////////////
    
    else if($action=="upavat"){
    
            addonline(getuid_sid($sid),"Uploading avatar image","lists.php?action=$action");
    
            $whonick = getnick_uid($who);
    
    
    
        boxstart("Upload Avatar");
    
    
    
    
    
            echo "<p><u>Choose the pic:</u><br/>
    
            <form enctype=\"multipart/form-data\" action=\"genproc.php?action=upavat&amp;sid=$sid\" method=\"post\">
    
            Image(JPG/JPEG image only):<br/>Size limit: 512KB<br/>Image will be resized to fit its width to 128 pixels.
    
            <input type=\"file\" name=\"attach\"/><br/>
    
            <input id=\"inputButton\" type=\"submit\" name=\"submit\" value=\"Send\"/></form></p>
    
    ";
    
    }
    ________________
    Jacques
    jacques@gw-designs.co.za
    http://coding.biz.tm
    Come join and lets make it a place to learn all the noobies how to code
    __________________

    NEVER FORGET TO CLICK THE TANX BUTTON IF U LIKE WHAT IM SHARING OR HELPING WITH

    Comment


      #3
      this script is for lavalir.
      I would like to wapdesire because it is a different database

      Comment


        #4
        well use this and modify it to work on wapdesire
        ________________
        Jacques
        jacques@gw-designs.co.za
        http://coding.biz.tm
        Come join and lets make it a place to learn all the noobies how to code
        __________________

        NEVER FORGET TO CLICK THE TANX BUTTON IF U LIKE WHAT IM SHARING OR HELPING WITH

        Comment


          #5
          I tried this already but did not play out in spite of all thanks for your help

          Comment


            #6
            so someone put a wapdesire v2 upload avatar script??anyone?

            Comment


              #7
              you dont upload the avatar you add the avatar you want on the site to the avatar folder and it does automatically
              and before you say it yes thats on wapdesire v2 script as for the auto add to profile aint a clue i got the coding to auto add a persons pic to profiles but not avatar
              Last edited by floyd; 20.12.10, 02:01.

              Comment


                #8
                dominik92r just copy the smilie code in WapD v2 n edit so u can upload the from tools i will do it n post what i main here..

                Comment

                Working...
                X