EasyPhp 1.7 & GD2

Résolu
Shinon Messages postés 4 Date d'inscription vendredi 19 septembre 2003 Statut Membre Dernière intervention 25 janvier 2005 - 25 janv. 2005 à 02:17
coucou747 Messages postés 12303 Date d'inscription mardi 10 février 2004 Statut Membre Dernière intervention 30 juillet 2012 - 25 janv. 2005 à 08:44
Bonjour,

je souhaiterais faire tourner un script permettant de générer des codes barres, mais je n'y arrive pas, et je ne sais pas si c'est le script qui 'déconne' ou mon install de GD

je ne sais pas comment faire pour installer GD, quand je regarde le phpinfo() j'ai les lignes suivantes :


GD Support,
enabled,
----

GD Version,
bundled (2.0.15 compatible),
----

FreeType Support,
enabled,
----

FreeType Linkage,
with freetype,
----

GIF Read Support,
enabled,
----

JPG Support,
enabled,
----

PNG Support,
enabled,
----

WBMP Support,
enabled,
----

XBM Support,
enabled

Mais je ne sais pas si il est installé correctement.

comment faire pour en etre sur.

merci d'avance

3 réponses

cs_OriOn Messages postés 822 Date d'inscription vendredi 25 mai 2001 Statut Modérateur Dernière intervention 1 août 2014
25 janv. 2005 à 08:33
GD est correctement installé, c'est pas moi qui te le dit mais php ;-)

Pour le tester, tu n'as qu'à utiliser les fonctions GD de php, tu verras, ça marche ;-)

tch@o..

orion
http://blogs.developpeur.org/orion/
3
coucou747 Messages postés 12303 Date d'inscription mardi 10 février 2004 Statut Membre Dernière intervention 30 juillet 2012 44
25 janv. 2005 à 08:41
un petit exemple qui montre en même temps la puissance de GD :

index.php
<html>
<head>
<title>RPG</title>
</head>

<?php
function save($xscrool, $yscrool, $case, $joueur, $anglex, $angley){
$fp=fopen("joueur$joueur.php","w");
fputs($fp,"<?php\n");
fputs($fp,"$");
fputs($fp,"xscrool=$xscrool;\n");
fputs($fp,"$");
fputs($fp,"yscrool=$yscrool;\n");
fputs($fp,"$");
fputs($fp,"case=$case;\n");
fputs($fp,"$");
fputs($fp,"anglex=$anglex;\n");
fputs($fp,"$");
fputs($fp,"angley=$angley;\n");
fputs($fp,"?>\n");

}
$joueur=1;
include("joueur$joueur.php");
$a=$_GET['deplace'];
switch($a){
case 4:
$xscrool-=100;
break;
case 6:
$xscrool+=100;
break;
case 8:
$yscrool-=100;
break;
case 2:
$yscrool+=100;
break;
}
if ($a!=0){
save($xscrool,$yscrool, $case, $joueur, $anglex, $angley);
}
echo "<center>
, <table>
----, </td><center>^
|</center>, ,
----
<center><-</center>,
<center></center>,
<center>-></center>,
----
, <center>|
\/</center>, ,
</center>
</td>
";
?>

</html>


images.php

<?

function poly($pt1, $pt2, $pt3, $pt4, $x, $y, $terrain, $max, $im, $black, $couleurs){
$centerx=($x[$pt1]+$x[$pt2]+$x[$pt3])/3;
$centery=($y[$pt1]+$y[$pt2]+$y[$pt3])/3;
poly2($pt1, $pt2, $centerx, $centery, $x, $y, $terrain, $max, $im, $black, $couleurs);
poly2($pt3, $pt2, $centerx, $centery, $x, $y, $terrain, $max, $im, $black, $couleurs);
poly2($pt3, $pt4, $centerx, $centery, $x, $y, $terrain, $max, $im, $black, $couleurs);
poly2($pt1, $pt4, $centerx, $centery, $x, $y, $terrain, $max, $im, $black, $couleurs);
imagepolygon($im, array($x[$pt1], $y[$pt1], $x[$pt2], $y[$pt2], $x[$pt3], $y[$pt3], $x[$pt4], $y[$pt4]), 4, $black );
}

function poly2($pt1, $pt2, $centerx, $centery, $x, $y, $terrain, $max, $im, $black, $couleurs){
$v=round(($terrain[$pt1]+$terrain[$pt2])/$max/2*10);
imagefilledpolygon($im, array($x[$pt1], $y[$pt1], $x[$pt2], $y[$pt2], $centerx, $centery), 3, $couleurs[$v] );
}

mt_srand(microtime() * 1000000);
header ("Content-type: image/png");
$terrain=1;
include("terrain$terrain.php");
$im = ImageCreate (640, 480)
or die ("Erreur lors de la création de l'image");
$couleur_fond = ImageColorAllocate ($im, 0, 0, 0);

$angley=$_GET['angley'];
$anglex=$_GET['anglex'];
$case=$_GET['case'];
$xscrool=$_GET['xscrool'];
$yscrool=$_GET['yscrool'];

$hauteur=50;
$black = imagecolorallocate($im, 0,0,0);
for ($a=0;$a<$dimx;$a++){
for ($b=0;$b<$dimy;$b++){
$x[$a+$b*$dimx]=($a+$b*$angley)*$case-$xscrool;
$y[$a+$b*$dimx]=($b+$a*$anglex-$terrain[$a+$b*$dimx]/$hauteur)*$case-$yscrool;
if ($x[$a+$b*$dimx]<0){
$x[$a+$b*$dimx]=0;
}
if ($y[$a+$b*$dimx]<0){
$y[$a+$b*$dimx]=0;
}
}
}

$couleurs[0] = imagecolorallocate($im, 0,0,128);
for ($i=1;$i<10;$i++){
$couleurs[$i] = imagecolorallocate($im, 0,$i*25,0);
}
for ($b=0;$b<$dimy-1;$b++){
for ($a=0;$a<$dimx-1;$a++){
if ($x[$a+$b*$dimx]<640 && $x[$a+1+($b+1)*$dimx]>0 && $y[$a+$b*$dimx]<480 && $y[$a+1+($b+1)*$dimx]>0){
poly(
$a+$b*$dimx,
$a+1+$b*$dimx,
$a+1+($b+1)*$dimx,
$a+($b+1)*$dimx,
$x, $y, $terrain, $max, $im, $black, $couleurs);
}
}
}
imagePng ($im);
?>


joueur1.php

<?php
$xscrool=200;
$yscrool=200;
$case=40;
$anglex=0.4;
$angley=-0.2;
?>

terrain1.php

<?
$dimx=20;
$dimy=20;
$max=35;
$terrain=array(
5, 5, 10, 10, 10, 10, 10, 10, 5, 0, 0, 0, 5, 10, 20, 5, 5, 5, 5, 10,
5, 10, 20, 10, 20, 10, 20, 10, 20, 0, 0, 0, 10, 20, 30, 25, 20, 15, 10, 10,
5, 5, 10, 20, 10, 20, 10, 20, 10, 0, 0, 5, 15, 20, 30, 30, 20, 15, 10, 10,
5, 10, 20, 10, 20, 20, 20, 10, 20, 0, 0, 10, 20, 35, 30, 30, 25, 20, 10, 10,
5, 5, 10, 20, 10, 20, 10, 20, 10, 0, 0, 0, 5, 10, 10, 15, 10, 10, 5, 5,
5, 10, 20, 10, 20, 10, 20, 10, 20, 0, 0, 0, 0, 0, 5, 5, 10, 10, 5, 5,
5, 5, 20, 20, 10, 10, 10, 20, 10, 0, 0, 0, 0, 0, 0, 0, 5, 0, 0, 0,
5, 10, 20, 10, 20, 10, 20, 10, 20, 0, 0, 0, 0, 0, 5, 5, 5, 5, 0, 0,
5, 5, 10, 20, 10, 20, 10, 20, 10, 0, 0, 0, 0, 5, 10, 10, 10, 10, 5, 0,
5, 5, 10, 15, 20, 25, 20, 30, 5, 0, 0, 0, 5, 10, 10, 10, 15, 15, 10, 0,
5, 10, 15, 20, 20, 20, 20, 25, 10, 0, 0, 0, 10, 15, 20, 20, 20, 20, 20, 10,
5, 5, 10, 20, 10, 20, 10, 10, 10, 0, 0, 5, 15, 20, 30, 25, 20, 15, 10, 10,
5, 10, 20, 10, 20, 10, 10, 10, 20, 0, 0, 10, 20, 35, 30, 30, 25, 20, 10, 10,
5, 5, 10, 20, 10, 10, 10, 20, 10, 0, 0, 0, 5, 10, 10, 15, 10, 10, 5, 5,
5, 10, 20, 20, 20, 10, 20, 20, 20, 0, 0, 0, 0, 0, 5, 5, 10, 10, 5, 5,
5, 5, 10, 20, 10, 20, 10, 20, 10, 0, 0, 0, 0, 0, 0, 0, 5, 0, 0, 0,
5, 10, 20, 10, 20, 20, 20, 10, 20, 0, 0, 0, 0, 0, 5, 5, 5, 5, 0, 0,
5, 5, 10, 20, 10, 20, 10, 20, 10, 0, 0, 0, 0, 5, 10, 10, 10, 10, 5, 0,
5, 5, 10, 15, 20, 25, 20, 30, 5, 0, 0, 0, 5, 10, 10, 10, 15, 15, 10, 5,
10, 10, 15, 20, 20, 20, 20, 25, 10, 0, 0, 0, 10, 15, 20, 20, 20, 20, 20, 10);
?>

la tu devrais avoir un joli terrain en 3d

In a dream, I saw me, drop dead... U was here, U cried... It was just a deam, if I die, U won't cry, maybe, U'll be happyhttp://coucou747.hopto.org
0
coucou747 Messages postés 12303 Date d'inscription mardi 10 février 2004 Statut Membre Dernière intervention 30 juillet 2012 44
25 janv. 2005 à 08:44
elle est vraiment conne cette boite de texte...

faut corriger ça franchement car la...

In a dream, I saw me, drop dead... U was here, U cried... It was just a deam, if I die, U won't cry, maybe, U'll be happy
http://coucou747.hopto.org
0
Rejoignez-nous