Il fait bien le travail qu'il doit faire, mais moi j'aimerais qu'il sauvegarde l'image dans une fichier et non pas l'afficher.
J'ai essayer diverse choses, mais sans succès, alor sje me tourne vers votre aide.
<?php
// Le fichier
$filename = 'images/flower.jpg';
// Définition de la largeur et de la hauteur maximale
$width = 150;
$height = 150;
// Content type
header('Content-type: image/jpeg');
// Cacul des nouvelles dimensions
list($width_orig, $height_orig) = getimagesize($filename);
$ratio_orig = $width_orig/$height_orig;
if ($width/$height > $ratio_orig) {
$width = $height*$ratio_orig;
} else {
$height = $width/$ratio_orig;
}
// Redimensionnement
$image_p = imagecreatetruecolor($width, $height);
$image = imagecreatefromjpeg($filename);
imagecopyresampled($image_p, $image, 0, 0, 0, 0, $width, $height, $width_orig, $height_orig);
// Affichage
imagejpeg($image_p, null, 100);
?>