$maxfilesize) stderr($lang_bitbucketupload['std_upload_failed'], $lang_bitbucketupload['std_file_too_large']); $pp=pathinfo($filename = $file["name"]); if($pp['basename'] != $filename) stderr($lang_bitbucketupload['std_upload_failed'], $lang_bitbucketupload['std_bad_file_name']); $tgtfile = getFullDirectory("$bitbucket/$filename"); if (file_exists($tgtfile)) stderr($lang_bitbucketupload['std_upload_failed'], $lang_bitbucketupload['std_file_already_exists'].htmlspecialchars($filename).$lang_bitbucketupload['std_already_exists'],false); $size = getimagesize($file["tmp_name"]); $height = $size[1]; $width = $size[0]; $it = $size[2]; if($imgtypes[$it] == null || $imgtypes[$it] != strtolower($pp['extension'])) stderr($lang_bitbucketupload['std_error'], $lang_bitbucketupload['std_invalid_image_format'],false); // Scale image to appropriate avatar dimensions $hscale=$height/$scaleh; $wscale=$width/$scalew; $scale=($hscale < 1 && $wscale < 1) ? 1 : (( $hscale > $wscale) ? $hscale : $wscale); $newwidth=floor($width/$scale); $newheight=floor($height/$scale); if ($it==1) $orig=@imagecreatefromgif($file["tmp_name"]); elseif ($it == 2) $orig=@imagecreatefromjpeg($file["tmp_name"]); else $orig=@imagecreatefrompng($file["tmp_name"]); if(!$orig) stderr($lang_bitbucketupload['std_image_processing_failed'],$lang_bitbucketupload['std_sorry_the_uploaded']."$imgtypes[$it]".$lang_bitbucketupload['std_failed_processing']); $thumb = imagecreatetruecolor($newwidth, $newheight); imagecopyresized($thumb, $orig, 0, 0, 0, 0, $newwidth, $newheight, $width, $height); switch ($it) { case 1: $ret = imagegif($thumb, $tgtfile); break; case 2: $ret = imagejpeg($thumb, $tgtfile); break; default: $ret = imagepng($thumb, $tgtfile); } // $ret=($it==1)?imagegif($thumb, $tgtfile): ($it==2)?imagejpeg($thumb, $tgtfile):imagepng($thumb, $tgtfile); $url = str_replace(" ", "%20", htmlspecialchars(get_protocol_prefix()."$BASEURL/bitbucket/$filename")); $name = sqlesc($filename); $added = sqlesc(date("Y-m-d H:i:s")); if (!isset($_POST['public']) || $_POST['public'] != 'yes' ) $public='"0"'; else $public='"1"'; sql_query("INSERT INTO bitbucket (owner, name, added, public) VALUES ({$CURUSER['id']}, $name, $added, $public)") or sqlerr(__FILE__, __LINE__); sql_query("UPDATE users SET avatar = ".sqlesc($url)." WHERE id = {$CURUSER['id']}") or sqlerr(__FILE__, __LINE__); stderr($lang_bitbucketupload['std_success'], $lang_bitbucketupload['std_use_following_url']."
$url

".$lang_bitbucketupload['std_upload_another_file'].".



".$lang_bitbucketupload['std_image']. ($width=$newwidth && $height==$newheight ? $lang_bitbucketupload['std_need_not_rescaling']:$lang_bitbucketupload['std_rescaled_from']."$height x $width".$lang_bitbucketupload['std_to']."$newheight x $newwidth") .$lang_bitbucketupload['std_profile_updated'],false); } stdhead($lang_bitbucketupload['head_avatar_upload']); ?>

"); print("
".$lang_bitbucketupload['text_upload_directory_unwritable']."
".$lang_bitbucketupload['text_disclaimer']."$scaleh".$lang_bitbucketupload['text_disclaimer_two']."$scalew".$lang_bitbucketupload['text_disclaimer_three'].number_format($maxfilesize).$lang_bitbucketupload['text_disclaimer_four']); ?>
>