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
O and its for WML
class Counter { public: void Count(); int ReadDisplay(); private: int CurrentCount; };
class Counter { public: void Count(); int ReadDisplay(); private: int CurrentCount; };
echo "<a href=\"lists.php?action=upavat&sid=$sid\">»Upload Avatar</a><br/>";
////////////////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."; } }
///////////////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> "; }
echo "<a href=\"lists.php?action=upavat&sid=$sid\">»Upload Avatar</a><br/>";
////////////////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."; } }
///////////////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> "; }
Comment