par
Tweak » 14 mai 2009, 08:43
Bonjour.
Grâce à une fonction je récupère l'emplacement de deux images que je superpose de cette manière :
Code : Tout sélectionner
$pixel=16;
function MapIdImg($id,$pixel)
{
$recup = mysql_query("SELECT img1,img2 FROM map WHERE id='$id'");
$recup = mysql_fetch_array($recup); $img1 = $recup['img1']; $img2 = $recup['img2'];
$img1 = ChipsLink($img1); $img1 = "img/chipset/$img1" ;
$img2 = ChipsLink($img2); $img2 = "img/chipset/$img2" ;
$img = @imagecreate($pixel, $pixel) or die ("Impossible de charger la bibliothéque graphique.");
$img1 = @ImageCreateFromPNG ($img1);
$img2 = @ImageCreateFromPNG ($img2);
ImageCopy ($img, $img1, 0, 0, 0, 0, $pixel, $pixel);
ImageCopy ($img, $img2, 0, 0, 0, 0, $pixel, $pixel);
header ("Content-type: image/png");
imagepng($img);
imagedestroy($img);
return $img;
}
Le code fonctionne, par contre il n'affiche pas ma page mais uniquement l'image, qui n'est même pas dans une page mais comme si j'avais ouvert l'image avec mon navigateur.
Bonjour.
Grâce à une fonction je récupère l'emplacement de deux images que je superpose de cette manière :
[code]
$pixel=16;
function MapIdImg($id,$pixel)
{
$recup = mysql_query("SELECT img1,img2 FROM map WHERE id='$id'");
$recup = mysql_fetch_array($recup); $img1 = $recup['img1']; $img2 = $recup['img2'];
$img1 = ChipsLink($img1); $img1 = "img/chipset/$img1" ;
$img2 = ChipsLink($img2); $img2 = "img/chipset/$img2" ;
$img = @imagecreate($pixel, $pixel) or die ("Impossible de charger la bibliothéque graphique.");
$img1 = @ImageCreateFromPNG ($img1);
$img2 = @ImageCreateFromPNG ($img2);
ImageCopy ($img, $img1, 0, 0, 0, 0, $pixel, $pixel);
ImageCopy ($img, $img2, 0, 0, 0, 0, $pixel, $pixel);
header ("Content-type: image/png");
imagepng($img);
imagedestroy($img);
return $img;
}[/code]
Le code fonctionne, par contre il n'affiche pas ma page mais uniquement l'image, qui n'est même pas dans une page mais comme si j'avais ouvert l'image avec mon navigateur.