par
vares2 » 12 janv. 2006, 14:39
tres cher mario, merci pour ton script, jai copié l'exemple 2 dans un fichier et je l'ai exécuté mais sa ne marche pas, aide moi.
Le script: pic.php
<?php
// Le fichier
$filename = 'marie.jpg';
// Définition de la largeur et de la hauteur maximale
$width = 200;
$height = 200;
// Content type
header('Content-type: image/jpeg');
// Cacul des nouvelles dimensions
list($width_orig, $height_orig) = getimagesize($filename);
if ($width && ($width_orig < $height_orig)) {
$width = ($height / $height_orig) * $width_orig;
} else {
$height = ($width / $width_orig) * $height_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);
?>
l'erreur:
<br />
<b>Fatal error</b>: imagecreatetruecolor(): requires GD 2.0 or later in <b>c:\program files\easyphp\www\abidjancell\pic.php</b> on line <b>22</b><br />
Merci pour ton aide precieuse
tres cher mario, merci pour ton script, jai copié l'exemple 2 dans un fichier et je l'ai exécuté mais sa ne marche pas, aide moi.
Le script: pic.php
<?php
// Le fichier
$filename = 'marie.jpg';
// Définition de la largeur et de la hauteur maximale
$width = 200;
$height = 200;
// Content type
header('Content-type: image/jpeg');
// Cacul des nouvelles dimensions
list($width_orig, $height_orig) = getimagesize($filename);
if ($width && ($width_orig < $height_orig)) {
$width = ($height / $height_orig) * $width_orig;
} else {
$height = ($width / $width_orig) * $height_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);
?>
l'erreur:
<br />
<b>Fatal error</b>: imagecreatetruecolor(): requires GD 2.0 or later in <b>c:\program files\easyphp\www\abidjancell\pic.php</b> on line <b>22</b><br />
Merci pour ton aide precieuse