bonjour,
j'utilise depuis des années une fonction de rotation d'image.
et cela marche a merveille mais voila la j'essaye d'en faire usage dans un autre cas et patatra !
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23 function rotation($img, $degres) { if (file_exists($img)) { $image = getimagesize($img); $image_type = $image['2']; // création de l'image selon son extension (type) : if ($image_type == "1") $source = imagecreatefromgif($img); if ($image_type == "2") $source = imagecreatefromjpeg($img); if ($image_type == "3") $source = imagecreatefrompng($img); if ($image_type == "6") $source = imagecreatefromwbmp($img); //rotation de l'image $rotation = imagerotate($source, $degres, 0) or die("Erreur lors de la rotation "); //Le -1 permet de remplir les zones vides avec du transparent // sauvegarde de l'image (selon son type : if ($image_type == "1") imagegif($rotation, $img); if ($image_type == "2") imagejpeg($rotation, $img); if ($image_type == "3") imagepng($rotation, $img); if ($image_type == "6") imagewbmp($rotation, $img); } }
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22 <?php session_start(); include_once('path.php'); require $path . '/vendor/autoload.php'; include $path . '/config/prod.php'; include_once($path . '/fonctions/fc_rotation_img.php'); $id = intval($_GET['id']); ini_set("log_errors", 1); ini_set("error_log", "rotation.log"); // file exist retourne true $data = $conn->fetchAssoc('SELECT file, id_profil, type_compte, extension FROM piece_jointe_profil WHERE id= ?', array($id)); // repertoire hors acces web $file = '../../../ressources/justificatifs/' . $data['file'] . '.' . $data['extension']; rotation($file, '90'); header("location:gestion_justificatifs/aff_justif.php?id=" . $id);
pas de retour d'erreur ça fonctionne de temps en temps
Partager