Bonjour,
Je cherche à rogner une image...
Pour ca, j'utilise la fonction imagecopyresampled de la librairie GD...
Voici mon code:
Je précise que l'appel de ce code se fait en ajax...
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 <? $nom_image=$_POST["nom_image"]; $new_width=$_POST["new_width"]; $new_height=$_POST["new_height"]; $width=$_POST["width"]; $height=$_POST["height"]; $cadre_left=$_POST["cadre_left"]; $cadre_top=$_POST["cadre_top"]; // Redimensionnement $filename="images/$nom_image"; $image_p = imagecreatetruecolor($new_width, $new_height); $image = imagecreatefromjpeg($filename); imagecopyresampled($image_p, $image, 0, 0, $cadre_left, $cadre_top, $new_width, $new_height, $width, $height); $img_dest="images/redimensionne/".$nom_image; $res_creat_img=imagejpeg($image_p,$img_dest,100); ?>
Voici maintenant l'errreur retournée:
La fonction imagejpeg renvoi false...<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>Error 500 - Internal server error</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="cache-control" content="no-cache" />
</head>
<body style="font-family:arial;">
<h1 style="color:#0a328c;font-size:1.0em;">Error 500 - Internal server error</h1>
<p style="font-size:0.8em;">Un problème inattendu est survenu. <br/>Veuillez réessayer ultérieurement.</p>
</body>
</html>
Pourquoi ca ne marche pas?
Partager