File manager - Edit - /home/missmand/public_html/learning/admin/agenda/cropAgenda.php
Back
<?php include '../lib/init.php'; Tool::verif_connect(); /* Variables */ $agendaId = Tool::getId($_GET['agenda'],'managerAgenda.php'); $action = Tool::getString($_GET['etat'],'managerAgenda.php'); Auth::roleAccesAuth(array(5)); /* limitation de l'accès par rôle */ Action::ifAgenda($bdd,$agendaId); /* Information sur l'image */ $sql = $bdd->query("SELECT agendaTmp, agendaMiniature FROM agenda WHERE agendaId = $agendaId "); $data = $sql->fetch(); $tmp = BASEFRONT.'img/agenda/tmp/'.$data['agendaTmp']; $image = $data['agendaMiniature']; if(isset($_POST['submit'])){ if(!empty($image)){ unlink("../../img/agenda/miniature/$image"); } $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') ) $image = Upload::cropJpg($tmp,$w,$h,$x1,$y1,$x2,$y2,'../../img/agenda/miniature/'); else if($ext = 'png') $image = Upload::cropPng($tmp,$w,$h,$x1,$y1,$x2,$y2,'../../img/agenda/miniature/'); $bdd->query("UPDATE agenda SET agendaMiniature = '$image' WHERE agendaId = $agendaId "); //Redirection if($action == 'ajout') setFlash('Événement ajouté avec succès'); else if ($action == 'modif'){ setFlash('Événement modifié avec succès'); } header('location:'.BASEADMIN.'agenda/managerAgenda.php'); } ?> <!doctype html> <html lang="fr"> <head> <meta charset="utf-8"> <title><?php echo TITLE ?></title> <link href='http://fonts.googleapis.com/css?family=Open+Sans:300italic,400italic,600italic,800italic,400,300,600,700' rel='stylesheet' type='text/css'/> <link href="<?php echo BASEADMIN ?>css/init.css" rel="stylesheet" type="text/css" /> <link href="<?php echo BASEADMIN ?>css/template.css" rel="stylesheet" type="text/css" /> <link href="<?php echo BASEADMIN ?>css/crop/imgareaselect-default.css" rel="stylesheet" type="text/css" /> </head> <body> <div id="main"> <!-- En tête --> <?php include '../include/header.php'; ?> <!-- Menu latéral --> <?php include '../include/menu.php'; ?> <div id="conteneur"> <div id="titre"> <h1>Recadrer une image</h1> <span id="flecheTitre"></span> </div> <div class="inner"> <ul id="breadcrumb"> <li><a href="<?php echo BASEADMIN ?>admin.php">Accueil</a> <span class="divider">»</span></li> <li><a href="<?php echo BASEADMIN ?>agenda/managerAgenda.php">Gestion des événements</a> <span class="divider">»</span></li> <li class="active">Recadrer une image</li> </ul> <?php /* Image temporaire */ echo'<div id="image">'; echo'<img id="photo" src="'.$tmp.'" style="max-width:960px;" title="Cliquez et glissez pour recadrer"/>'; echo'</div>'; ?> <br /> <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="submit" id="crop" class="submit medium vert" value="Recadrer l'image" /> </form> </div> </div> </div> <script type="text/javascript" src="<?php echo BASEADMIN ?>js/jquery.js"></script> <script type="text/javascript" src="<?php echo BASEADMIN ?>js/jquery-ui.js"></script> <script type="text/javascript" src="<?php echo BASEADMIN ?>js/jquery.imgareaselect.pack.js"></script> <script type="text/javascript" src="<?php echo BASEADMIN ?>js/script.js"></script> <script type="text/javascript"> $(document).ready(function(){ $('img#photo').imgAreaSelect({ aspectRatio: '420:275', handles: true, 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); } }); $('#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("Veuillez choisir une zone à recadrer"); return false; }else{ return true; } }); }); </script> </body> </html>
| ver. 1.4 |
Github
|
.
| PHP 7.4.33 | Generation time: 0.01 |
proxy
|
phpinfo
|
Settings