Help me ASAP - images error
Posted: Mon Apr 23, 2007 6:54 am
feyd | Please use
chart.php:
This my text.When Iam running example.php, Iam getting erorr 'image cannot be displayed,since it contains errors' can you pls help me pls.I have check output buffering in s/opt/lampp/etc/php.ini, it is off.I removed space after last line in example,chart,growthchart.class,jpgraph,jpgraph-line,jpgraph-restat php files
Please Kindly help me ASAP
feyd | Please use
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
1) Environment : Red Hat Linux 5.x
2) PHP version 2.x
3) Apache
4) I have used xampp for installing php and apache
5)example.phpCode: Select all
<?php
include('GrowthChart.class.php');
$patientXData = array(2, 4, 6, 8, 10, 12);
$patientYData = array(36, 40, 42.2, 44, 45, 45.8 );
$xvals = join(',', $patientXData);
$yvals = join(',', $patientYData);
?>
<html>
<head>
<title>Growth Chart Example</title>
</head>
<body>
<img src="chart.php?style=<?= GrowthChart::STYLE_HEAD_AGE ?>&sex=<?= GrowthChart::SEX_MALE ?>&maxage=35&xvals=<?= $xvals ?>&yvals=<?= $yvals ?>" />
</body>
</html>Code: Select all
<?php
include_once('GrowthChart.class.php');
import_request_variables('g', 'url_');
$style = null;
$sex = null;
$maxage = null;
$width = null;
$height = null;
// check for minimum required variables
if (!isset($url_style) || !isset($url_sex) || !isset($url_maxage))
{
die('One or more expected request variables not present.');
}
// check style value
if (!is_numeric($url_style) || (int)$url_style < 0 || (int)$url_style > 5)
{
die('Style value out of range: ' . $url_style);
}
$style = $url_style;
// check sex value
if (!is_numeric($url_sex) || $url_sex < 1 || $url_sex > 2)
{
die('Sex value out of range: ' . $url_sex);
}
$sex = $url_sex;
// check maximum age value
if (!is_numeric($url_maxage) || $url_maxage < 0)
{
die('Maximum age value out of range: ' . $url_maxage);
}
$maxage = $url_maxage;
// check image width
if (isset($url_width) && !is_numeric($url_width))
{
die('Image width value out of range: ' . $url_width);
}
$width = (isset($url_width) ? $url_width : 800);
// check image height
if (isset($url_height) && !is_numeric($url_height))
{
die('Image height value out of range: ' . $url_height);
}
$height = (isset($url_height) ? $url_height : 800);
$patientXarray = null;
$patientYarray = null;
// check patient data values
// expecting comma-separated lists of x coordinates and y coordinates
if (isset($url_xvals) && isset($url_yvals))
{
$paX = split(',', $url_xvals);
$paY = split(',', $url_yvals);
if (sizeof($paX) == sizeof($paY))
{
$okay = true;
foreach ($paX as $value)
{
if (!is_numeric($value))
$okay = false;
}
foreach ($paY as $value)
{
if (!is_numeric($value))
$okay = false;
}
if ($okay)
{
$patientXarray = $paX;
$patientYarray = $paY;
}
}
}
$chart = new GrowthChart($style, $sex, $maxage, $width, $height, $patientXarray, $patientYarray);
$chart->render();
?>Please Kindly help me ASAP
feyd | Please use
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]