Newbie question: GD and PHP all looks good but no images!!
Moderator: General Moderators
-
loganlinux
- Forum Newbie
- Posts: 5
- Joined: Mon Jul 14, 2003 2:44 am
Newbie question: GD and PHP all looks good but no images!!
Hi friends,
I have everything installed to get graphs from php (ie gdlib etc) but it doesnt seem to be working.
I hope this screenshot comes through...Im trying to get a simple png from php 4.2.2 but its not working (sadly i am using redhat 9 -shrike)
PLEASE HELP!
gd is enabled from the PHP settings/config!! (screenshot didnt work!)
I have everything installed to get graphs from php (ie gdlib etc) but it doesnt seem to be working.
I hope this screenshot comes through...Im trying to get a simple png from php 4.2.2 but its not working (sadly i am using redhat 9 -shrike)
PLEASE HELP!
gd is enabled from the PHP settings/config!! (screenshot didnt work!)
- twigletmac
- Her Royal Site Adminness
- Posts: 5371
- Joined: Tue Apr 23, 2002 2:21 am
- Location: Essex, UK
-
loganlinux
- Forum Newbie
- Posts: 5
- Joined: Mon Jul 14, 2003 2:44 am
- twigletmac
- Her Royal Site Adminness
- Posts: 5371
- Joined: Tue Apr 23, 2002 2:21 am
- Location: Essex, UK
-
loganlinux
- Forum Newbie
- Posts: 5
- Joined: Mon Jul 14, 2003 2:44 am
Sample of PHP GD code
Hi, thanks for the reply!
Simple -
<?php
Header("Content-type: image/gif");
$string=implode($argv," ");
$im = imagecreatefromgif("images/button1.gif");
$orange = ImageColorAllocate($im, 220, 210, 60);
$px = (imagesx($im)-7.5*strlen($string))/2;
ImageString($im,3,$px,9,$string,$orange);
ImageGif($im);
ImageDestroy($im);
?>
and a phpinfo() query returns that php4.2.2 is installed and --with gd and all the font types are included in the configuration. Dont know if this means it should work??
Simple -
<?php
Header("Content-type: image/gif");
$string=implode($argv," ");
$im = imagecreatefromgif("images/button1.gif");
$orange = ImageColorAllocate($im, 220, 210, 60);
$px = (imagesx($im)-7.5*strlen($string))/2;
ImageString($im,3,$px,9,$string,$orange);
ImageGif($im);
ImageDestroy($im);
?>
and a phpinfo() query returns that php4.2.2 is installed and --with gd and all the font types are included in the configuration. Dont know if this means it should work??
-
loganlinux
- Forum Newbie
- Posts: 5
- Joined: Mon Jul 14, 2003 2:44 am
Sample of PHP GD code
Hi, thanks for the reply!
Simple -
<?php
Header("Content-type: image/gif");
$string=implode($argv," ");
$im = imagecreatefromgif("images/button1.gif");
$orange = ImageColorAllocate($im, 220, 210, 60);
$px = (imagesx($im)-7.5*strlen($string))/2;
ImageString($im,3,$px,9,$string,$orange);
ImageGif($im);
ImageDestroy($im);
?>
and a phpinfo() query returns that php4.2.2 is installed and --with gd and all the font types are included in the configuration. Dont know if this means it should work??
Simple -
<?php
Header("Content-type: image/gif");
$string=implode($argv," ");
$im = imagecreatefromgif("images/button1.gif");
$orange = ImageColorAllocate($im, 220, 210, 60);
$px = (imagesx($im)-7.5*strlen($string))/2;
ImageString($im,3,$px,9,$string,$orange);
ImageGif($im);
ImageDestroy($im);
?>
and a phpinfo() query returns that php4.2.2 is installed and --with gd and all the font types are included in the configuration. Dont know if this means it should work??
-
loganlinux
- Forum Newbie
- Posts: 5
- Joined: Mon Jul 14, 2003 2:44 am
Thanks patrick,
No, it seems there is no extra line breaks
Here is another "simpler" example that I am trying to get working...
This actually gives no error and displays nothing on the page!
php tag
header("Content-type = image/png");
$im = imagecreate (300, 300);
$white = imagecolorallocate ($im,255,255,255);
$blue = imagecolorallocate ($im,0,0,255);
close php tage
then the second part in the saem file
open php tag
imagestring ($im, 5, 0, 0 "I need this to work!", $blue);
close tag
No, it seems there is no extra line breaks
Here is another "simpler" example that I am trying to get working...
This actually gives no error and displays nothing on the page!
php tag
header("Content-type = image/png");
$im = imagecreate (300, 300);
$white = imagecolorallocate ($im,255,255,255);
$blue = imagecolorallocate ($im,0,0,255);
close php tage
then the second part in the saem file
open php tag
imagestring ($im, 5, 0, 0 "I need this to work!", $blue);
close tag