示例#1
0
    $cliparts_path = $_GET['cliparts'];
    if ($type == 'send' || $type == 'snap') {
        $data = $_POST['img'];
        list($format, $data) = explode(';', $data, 2);
        list(, $data) = explode(',', $data, 2);
        $data = str_replace(' ', '+', $data);
        $data = base64_decode($data);
        /*
        $path = $_FILES["image"]["tmp_name"];
        $img = imagecreatefrompng($path);
        imagepng($img, "out.png");
        */
        global $IMAGES_PATH;
        $id = $user->getId();
        $path = $IMAGES_PATH . "/" . $id . ".png";
        if ($type == 'snap') {
            file_put_contents($path, $data);
        } else {
            $path = save_image($id, $user->getName(), $data);
        }
        imagefusion($path, $cliparts_path, $path);
        echo $path;
    } else {
        echo "Invalide type";
    }
} else {
    require_once "view/montage.view.php";
}
?>

示例#2
0
require_once "model/image.model.php";
$action = isset($_GET['action']);
$imgs = load_images();
$page = isset($_GET['page']) ? $_GET['page'] * 1 : 1;
$nbr = isset($_GET['nbr']) ? $_GET['nbr'] * 1 : 3;
unset($user);
if (isset($_SESSION['user'])) {
    $user = new userCon($_SESSION['user']);
}
if ($action && $user) {
    $action = $_GET['action'];
    $id = $_POST['id'];
    if ($action == 'comment') {
        $message = htmlentities($_POST['message']);
        comment_image($id, $user->getName(), $message);
        $mail_message = "Bonjour l'une de vos images a recus un commentaire !\n" . "Pour lire le commentaire: " . $LIEN_SITE . "index.php?href=acceuil&page=" . $page . "\n";
        if (!mail($user->getEmail(), "Nouveau commentaire", $mail_message)) {
            echo "Un probleme est survenue lors de l'envoie du mail" . PHP_EOL;
        }
    } else {
        if ($action == 'like') {
            like_image($id, $user->getId());
            /*
            		$mail_message = "Une personne a aimer votre image !\n"
            						.$LIEN_SITE."index.php?href=acceuil&page=".$page."\n";
            		if (!mail($user->getEmail(), "Nouveau commentaire", $mail_message))
            			echo "Un probleme est survenue lors de l'envoie du mail" . PHP_EOL;
            */
        } else {
            if ($action == 'unlike') {