Пример #1
0
            $error["result"] = "There was an error moving the uploaded file.";
        } else {
            $avatar_source = cleanit($_POST['avatarsource']);
            $sql = "UPDATE " . table_groups . " set group_avatar='uploaded' WHERE group_id={$idname}";
            $db->query($sql);
            $main_smarty->assign('Avatar_uploaded', 'Avatar uploaded successfully!');
            /*if($avatar_source != "" && $avatar_source != "useruploaded"){
            			loghack('Updating profile, avatar source is not one of the list options.', 'username: '******'|email: '.$_POST["email"]);
            			$avatar_source == "";
            		}*/
            //$user->avatar_source=$avatar_source;
            //$user->store();
        }
    }
    // create large avatar
    include mnminclude . "class.pThumb.php";
    $img = new pThumb();
    $img->pSetSize(group_avatar_size_width, group_avatar_size_height);
    $img->pSetQuality(100);
    $img->pCreate($newimage);
    $img->pSave($user_image_path . $idname . "_" . group_avatar_size_width . ".jpg");
    $img = "";
}
function cleanit($value)
{
    $value = strip_tags($value);
    $value = trim($value);
    return $value;
}
$main_smarty->assign('tpl_center', $the_template . '/edit_group_center');
$main_smarty->display($the_template . '/pligg.tpl');
Пример #2
0
            $newimage = $user_image_path . $imagename;
            $result = move_uploaded_file($_FILES['image_file']['tmp_name'], $newimage);
            if (empty($result)) {
                $error["result"] = "There was an error moving the uploaded file.";
            }
        }
        // create large avatar
        include mnminclude . "class.pThumb.php";
        $img = new pThumb();
        $img->pSetSize(Avatar_Large, Avatar_Large);
        $img->pSetQuality(100);
        $img->pCreate($newimage);
        $img->pSave($user_image_path . $user->id . "_" . Avatar_Large . ".jpg");
        $img = "";
        // create small avatar
        $img = new pThumb();
        $img->pSetSize(Avatar_Small, Avatar_Small);
        $img->pSetQuality(100);
        $img->pCreate($newimage);
        $img->pSave($user_image_path . $user->id . "_" . Avatar_Small . ".jpg");
        $img = "";
        $db->query($sql = "UPDATE " . table_users . " SET user_avatar_source='useruploaded' WHERE user_id='{$user->id}'");
        unset($cached_users[$user->id]);
    } else {
        echo 'An error occured while uploading your avatar.';
    }
}
if (isset($error) && is_array($error)) {
    while (list($key, $val) = each($error)) {
        echo $val;
        echo "<br>";