Page 1 sur 1

Probleme de création d'image

Posté : 07 avr. 2006, 00:54
par chatainsim
Bonjour, j'ai un probléme avec un script qui génére une image png.
Sur la version xampp de windows, cela fonctionne, mais sur lampp sur linux ça ne fonctionne plus, et je n'arrive pas à voir pk !
Si quelqu'un peut m'aider, voici le code de la page :
<?
session_start();
header("Content-type: image/png");
include("config.php");
$fontsize = $_GET['fontsize'];
$fontfamily = $_GET['font'];
$background = $_GET['color_bg'];
$fontcolor = $_GET['fontcolor'];
$x = $_GET['size_x'];
$y = $_GET['size_y'];
$h = $fontsize+5;
$h2 = $h*'2';
$first = urlencode($_GET['line1']);
$second = urlencode($_GET['line2']);
$border = $_GET['border'];
$first= str_replace('$title',$_GET['title'],$first);
$first = urlencode($first);
$second = str_replace('$artist',$_GET['artist'],$second);
$second = urlencode($second);
//mixed str_replace ( mixed search, mixed replace, mixed subject [, int &count] )
$source = imagecreatefrompng("../img/croche.png");
$im = imagecreate ($x, $y);
// fond blanc et texte blanc
//A remplacer par une fonction switch
if ($background == 'white') { $bg = imagecolorallocate($im, 255, 255, 255); }
if ($background == 'blue') { $bg = imagecolorallocate($im, 0, 0, 255); }
//....
if ($fontcolor == 'white') { $textcolor = imagecolorallocate($im, 255, 255, 255); }
if ($fontcolor == 'blue') { $textcolor = imagecolorallocate($im, 0,0, 255); }
//...
$noir = imagecolorallocate($im, 0, 0, 0);
$text = "".$first."";
$text1 = "".$second."";
imagettftext($im, $fontsize, 0, 52, $h, $textcolor, "./font/".$fontfamily.".ttf", $text);
imagettftext($im, $fontsize, 0, 52, $h2, $textcolor, "./font/".$fontfamily.".ttf", $text1);
if ($border == 1)
{
     ImageRectangle ($im, 0, 0, $x-1, $y-1, $noir);
}
imagecopymerge($im, $source, 1, 1, 0, 0, 50, 50, 100);
imagepng($im);
$miniature = "../img/user/mcdb_".md5($_SESSION['pseudo']).".png";
Imagepng($im, $miniature);
?>

Posté : 07 avr. 2006, 08:55
par Cyrano
Si ça fonctionne sous Windows mais pas sous Linux, vérifie donc sous Linux si tu as correctement activé les mêmes extensions de PHP, GD2 en particulier.

As-tu un message d'erreur ?

Posté : 09 avr. 2006, 12:15
par chatainsim
Oui les mêmes extensions sont activée, et je n'ai aucun message d'erreur ...

Posté : 09 avr. 2006, 15:05
par chatainsim
GD est bien activé :

Code : Tout sélectionner

gd GD Support enabled GD Version bundled (2.0.28 compatible) FreeType Support enabled FreeType Linkage with freetype FreeType Version 2.1.7 GIF Read Support enabled GIF Create Support enabled JPG Support enabled PNG Support enabled WBMP Support enabled XBM Support enabled

Posté : 09 avr. 2006, 18:23
par Cyrano
As-tu bien configuré display_error à E_ALL sous Linux ?

Posté : 09 avr. 2006, 22:18
par Dux
Salut, pareil que cyrano
tu as peut etre un notice qui traine...

commente le header() du début
puis appelle ton script directement.

Tu as peut être un problème de permissions pour le repertoire "../img/user/"