cs_Minch
Messages postés6Date d'inscriptionmardi 9 novembre 2004StatutMembreDernière intervention 3 novembre 2005
-
28 avril 2005 à 12:15
cs_Minch
Messages postés6Date d'inscriptionmardi 9 novembre 2004StatutMembreDernière intervention 3 novembre 2005
-
28 avril 2005 à 15:02
Bonjour,
Après avoir verifié que ma librairie GD est bien enable et avoir supprimé les espaces superflus de mon code:
<?php
// Fonctions de service
function chgCoordX( $x)
{
global $hom;
return $hom *( 1 + $x);
}
function chgCoordY( $y)
{
global $hom;
return $hom *( 1 - $y);
}
// Dimension du graphique$diagramWidth $diagramHeight 200;
$hom = $diagramWidth/2;
// Tableaux des coordonnées
for( $j=0; $j<5; $j++)
{
$A[$j] = cos( 2*$j*PI() / 5);
$B[$j] = sin( 2*$j*PI() / 5);
}
// On croise les points (on les prende 2 en 2 modulo 5)
$X[0] = chgCoordX( $A[0]); $Y[0] = chgCoordY( $B[0]);
$X[1] = chgCoordX( $A[2]); $Y[1] = chgCoordY( $B[2]);
$X[2] = chgCoordX( $A[4]); $Y[2] = chgCoordY( $B[4]);
$X[3] = chgCoordX( $A[1]); $Y[3] = chgCoordY( $B[1]);
$X[4] = chgCoordX( $A[3]); $Y[4] = chgCoordY( $B[3]);
// On construit l image
$hImg = imageCreate( $diagramWidth, $diagramHeight);
// Allocation de la couleur de l étoile
$colorBackgr = imageColorAllocate( $hImg, 0, 255, 0);
$c = imageColorAllocate( $hImg, 255, 255, 0);
// Tracé de l étoile$x1 $X[0]; $y1 $Y[0];
for( $i=1; $i<6; $i++)
{
$j=( $i%5);$x2 $X[$j]; $y2 $Y[$j];
imageLine( $hImg, $x1, $y1, $x2, $y2, $c);$x1 $x2; $y1 $y2;
}
if (imagetypes() & IMG_GIF)
{
header("Content-type: image/png");
imagePng($hImg);
}
elseif (imagetypes() & IMG_PNG)
{
header("Content-type: image/png");
imagePng( $hImg, 'etoile5.png');
}
else
{
die("Pas de support graphique avec PHP sur ce serveur");
}
?>
je n'obtient à l'affichage que l'icone d'image non trouvée. Je tourne avec IE V.6, est ce un problème de version? Mon image est bien générée dans mon repertoire pourtant!!!
Quelqu'un saurait il quel est le problème?
Merci d'avance!
AkeluX
Messages postés113Date d'inscriptionsamedi 15 mai 2004StatutMembreDernière intervention 9 mars 20072 28 avril 2005 à 14:07
Pour l'afficher dans IE tu mets directement l'image () ou tu mets le script () ?
Parce que tu peux envoye l'image dans un fichier et en plus au navigateur ?
Sinon tu dis si gif est supporté, je fais du png ??
if (imagetypes() & IMG_GIF)
{
header("Content-type: image/png");
imagePng($hImg);
}
elseif (imagetypes() & IMG_PNG)
{
header("Content-type: image/png");
imagePng( $hImg, 'etoile5.png'); <= Envoi l'image dans le fichier mais pas au navigateur }
cs_Minch
Messages postés6Date d'inscriptionmardi 9 novembre 2004StatutMembreDernière intervention 3 novembre 2005 28 avril 2005 à 15:02
J'y met l'image et autant pour moi le "si gif supporté, je fais du png" est une faute d'étourderie de ma part... c'est bien gif, mais ça n'a tout de même aucun effet sur mon affichage à l'arrivée... et je pensais effectivement pouvoir envoyer l'image dans un fichier et l'afficher, merci Akelux!