Gallery Upload to Avatar

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

    Gallery Upload to Avatar

    Can any 1 please help me with this code its for lava I want to upload profile pics straight to avatar but im struggling to get the code right please help me.....
    O and its for WML
    BakGat
    Code:
    class Counter {
    public:
      void Count();
      int  ReadDisplay();
    private:
      int  CurrentCount;
    };








    Back up my hard drive? How do I put it in reverse?
    My Community
    BakGat
    sigpic

    #2
    why dont you simply copy the image path from gallery mysql to avatar mysql table?
    Advertise your mobile site for FREE with AdTwirl

    Comment


      #3
      Please advice on were to find that GumSlone.....

      Thanks
      BakGat
      Code:
      class Counter {
      public:
        void Count();
        int  ReadDisplay();
      private:
        int  CurrentCount;
      };








      Back up my hard drive? How do I put it in reverse?
      My Community
      BakGat
      sigpic

      Comment


        #4
        PHP Code:
        mysql_query("UPDATE lietotaji SET avatar='path_to_file/".$changeable."' WHERE id='".$uid."'"); 
        or smth...
        Nous Ne Dansos Pas, Nous Sommes Le Danse.!

        Comment


          #5
          Here are an xhtml code u must just convert it

          Use this in cpanel or where ever
          Code:
          echo "<a href=\"lists.php?action=upavat&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&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


            #6
            Originally posted by riderz View Post
            Here are an xhtml code u must just convert it

            Use this in cpanel or where ever
            Code:
            echo "<a href=\"lists.php?action=upavat&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&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>
            
            ";
            
            }
            but u forget one thing, the older file must get deleted from avatar folder when new avatar is uploaded, otherwise it will bundle up useless images in the avatar folder.

            Comment


              #7
              well, possibly not...

              cause if you set up a user avatars table, users can have a gallery of uploaded avatars too... you just code it so they can only see the ones they uploaded type thing... I would have done it myself, but i couldn't be bothered, lol... not that significant in my eyes...
              C3 Themes: http://c3themes.wen.ru/index.html
              Find Files: http://mystarter.tk/?goto=X-search

              Comment


                #8
                plus... you gotta bulid up a collection some how y know, lol...
                C3 Themes: http://c3themes.wen.ru/index.html
                Find Files: http://mystarter.tk/?goto=X-search

                Comment


                  #9
                  just add new line update gallery pic button if yes then add it to avatar ! easy...
                  Visit: Chat4u.mobi - The New Lay Of being a site of your dreams!
                  Visit: WapMasterz Coming Back Soon!
                  _______
                  SCRIPTS FOR SALE BY SUBZERO
                  Chat4u Script : coding-talk.com/f28/chat4u-mobi-script-only-150-a-17677/ - > Best Script for your site no other can be hacked by sql or uploaders.
                  FileShare Script : coding-talk.com/f28/file-wap-share-6596/ -> Uploader you will never regret buying yeah it mite be old now but it still seems to own others...
                  _______
                  Info & Tips
                  php.net
                  w3schools.com

                  Comment

                  Working...
                  X