Code :
<?php //définition des variables $imgfile = "upload/small/".$url; $dest_small="upload/nails/".$url; $cropStartX = $_POST['sx']; $cropStartY = $_POST['sy']; $cropW = $_POST['ex']; $cropH = $_POST['ey']; // création des deux images temporaires $origimg = imagecreatefromjpeg($imgfile); $cropimg = imagecreatetruecolor($cropW,$cropH); // taille de l'originale // Crop imagecopyresized($cropimg, $origimg, 0, 0, $cropStartX, $cropStartY, $width, $height, $width, $height); // copie vers répertoire imagejpeg($cropimg, $dest_small,80); // Resize du crop $source_small = imagecreatefromjpeg($dest_small); $destination_small = imagecreatetruecolor(132, 88); $largeur_source_small = imagesx($source_small); $hauteur_source_small = imagesy($source_small); $largeur_destination_small = imagesx($destination_small); $hauteur_destination_small = imagesy($destination_small); imagecopyresampled($destination_small, $source_small, 0, 0, 0, 0, $largeur_destination_small, $hauteur_destination_small, $largeur_source_small, $hauteur_source_small); imagejpeg($destination_small, $dest_small,100); ?>
|