Hacked By AnonymousFox
<?php
include '../lib/init.php';
Utilisateur::verif_connect();
$utilisateurId = $_SESSION['utilisateur']['id'];
/* Information sur l'image */
$sql = $bdd->query("SELECT utilisateurAvatarMiniature, utilisateurAvatarTmp FROM utilisateur
WHERE utilisateurId = $utilisateurId ");
$data = $sql->fetchObject();
$tmp = BASEFRONT.'img/utilisateur/tmp/'.$data->utilisateurAvatarTmp;
$avatar = $data->utilisateurAvatarMiniature;
/* Validation du formulaire */
if(isset($_POST['crop'])){
/* Supprimer l'avatar en cours */
if(!empty($avatar)){
unlink("../img/utilisateur/miniature/$avatar");
}
/* Nouveaux points pour le crop de l'avatar */
$x1=$_POST["x1"];
$y1=$_POST["y1"];
$x2=$_POST["x2"];
$y2=$_POST["y2"];
$w=$_POST["w"];
$h=$_POST["h"];
$ext = strtolower(pathinfo($tmp, PATHINFO_EXTENSION));
/* Création du crop */
if( ($ext == 'jpg') || ($ext == 'jpeg') )
$avatar = Upload::cropJpg($tmp,$w,$h,$x1,$y1,$x2,$y2,'../img/utilisateur/miniature/');
else if($ext = 'png')
$avatar = Upload::cropPng($tmp,$w,$h,$x1,$y1,$x2,$y2,'../img/utilisateur/miniature/');
/* Mise à jour du compte utilisateur */
$bdd->query("UPDATE utilisateur SET utilisateurAvatarMiniature = '$avatar'
WHERE utilisateurId = $utilisateurId ");
/* Mise à de jour de la session */
$_SESSION['utilisateur']['avatar'] = $avatar;
//Redirection avec message de succès
setFlash('Compte modifié avec succès');
header('location:'.BASEFRONT.'compte/compte.php');
}
?>
<!doctype html>
<html lang="fr">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=320">
<meta name="viewport" content="width=device-width; initial-scale=0.8; maximum-scale=0.8;">
<title><?php echo compteCropTitle ?></title>
<link rel="icon" type="image/png" href="<?php echo BASEFRONT ?>img/favicon.png" />
<link href="<?php echo BASEFRONT ?>css/reset.css" rel="stylesheet" type="text/css" />
<link href="<?php echo BASEFRONT ?>css/template.css" rel="stylesheet" type="text/css" />
<link href="<?php echo BASEFRONT ?>css/compte.css" rel="stylesheet" type="text/css" />
<link href="<?php echo BASEFRONT ?>css/mobile.css" rel="stylesheet" type="text/css" />
<link href="<?php echo BASEFRONT ?>css/imgareaselect-default.css" rel="stylesheet" type="text/css" />
<link href='http://fonts.googleapis.com/css?family=Open+Sans:300italic,400italic,600italic,700italic,400,300,600,700,800' rel='stylesheet' type='text/css'>
<!--[if lt IE 9]>
<script src="<?php echo BASEFRONT ?>js/html5.js"></script>
<![endif]-->
</head>
<body>
<div id="main">
<?php
/* Menu principal */
include '../include/menu.php';
?>
<div id="conteneur">
<header id="header">
<div id="btnMenu"></div>
<ul id="retour">
<li><a href="<?php echo BASEFRONT ?>compte/compte.php"><?php echo compteCropRetourCompte ?></a></li>
<li class="separation"> | </li>
<li><?php echo compteCropRetourRecadrage ?></li>
</ul>
<?php
include '../include/portrait.php';
?>
</header>
<div id="contenu">
<?php
/* Image temporaire */
echo'<div id="avatarTmp">';
echo'<img id="photo" src="'.$tmp.'" title="'.compteCropInfoRecadrage.'"/>';
echo'</div>';
?>
<form method="post" action="#">
<input type="hidden" name="x1" id="x1" value="" />
<input type="hidden" name="y1" id="y1" value="" />
<input type="hidden" name="x2" id="x2" value="" />
<input type="hidden" name="y2" id="y2" value="" />
<input type="hidden" name="w" id="w" value="" />
<input type="hidden" name="h" id="h" value="" />
<input type="submit" name="crop" id="crop" class="submit" value="<?php echo compteCropSubmit ?>" />
</form>
<div class="clear"></div>
</div>
</div>
</div>
<script type="text/javascript" src="<?php echo BASEFRONT ?>js/jquery.js"></script>
<script type="text/javascript" src="<?php echo BASEFRONT ?>js/jquery-ui.js"></script>
<script type="text/javascript" src="<?php echo BASEFRONT ?>js/jquery.imgareaselect.pack.js"></script>
<script type="text/javascript" src="<?php echo BASEFRONT ?>js/template.js"></script>
<script type="text/javascript" src="<?php echo BASEFRONT ?>js/script.js"></script>
<script type="text/javascript">
$(document).ready(function(){
/* Objet crop JS avec les options */
$('img#photo').imgAreaSelect({
aspectRatio: '60:60',
handles: true,
parent:'#conteneur',
onSelectEnd: function (img, selection) {
$('input[name="x1"]').val(selection.x1);
$('input[name="y1"]').val(selection.y1);
$('input[name="x2"]').val(selection.x2);
$('input[name="y2"]').val(selection.y2);
$('input[name="w"]').val(selection.width);
$('input[name="h"]').val(selection.height);
}
});
/* Vérifier si il y'a bien un recadrage */
$('#crop').click(function() {
var x1 = $('#x1').val();
var y1 = $('#y1').val();
var x2 = $('#x2').val();
var y2 = $('#y2').val();
var w = $('#w').val();
var h = $('#h').val();
if(x1=="" || y1=="" || x2=="" || y2=="" || w==0 || h==0){
alert("<?php echo compteCropAlert ?>");
return false;
}else{
return true;
}
});
});
</script>
</body>
</html>
Hacked By AnonymousFox1.0, Coded By AnonymousFox