1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
| <?php
header("Content-type: image/png"); //la ligne qui change tout !
if(isset($_GET['recher']) || empty($_GET['$img'])){
$recher = $_GET['recher'];
$motif = "/";
$rep = "-";
$rech = ereg_replace($motif,$rep,$recher);
$img = $_GET['img'];
include('connection.php');
$reche = mysql_real_escape_string($rech);
$req = mysql_query("select y,x,reference from incendie where reference='$reche'") or die(mysql_error());
while($ref = mysql_fetch_array($req)){
$x= $ref['x'];
$y= $ref['y'];
}
$image=imagecreatefromjpeg($img);
$color = "#FF0000";
$rouge = hexdec(substr($color,0)); //conversion du canal rouge
$vert = hexdec(substr($color,215)); //conversion du canal vert
$bleu = hexdec(substr($color,215)); //conversion du canal bleu
$couleur = imagecolorallocate($image,$rouge,$vert,$bleu);
ImageEllipse($image,$y,$x,250,250,$rouge); //on créé un cercle
ImagePNG($image); //renvoie une image sous format png
imagedestroy($image);
}
?> |
Partager