I am having some trouble with gd image creation
I have some code that works
[CODE]$pic = “donationmeter/imagesadv/donation-meter0.png”;
header(“Content-type: image/png”);
$im = imagecreatefrompng($pic); /* Attempt to open */
//$bg = imagecolorallocate($im, 255, 255, 255);
$black = imagecolorallocate($im, 0, 0, 0);
$red = imagecolorallocate($im, 255, 0, 0);
$green = imagecolorallocate($im, 0, 205, 0);
$blue = imagecolorallocate($im, 0, 0, 255);
//$goal = number_format ($goal, 2);
$stringa = “Goal : “;
$stringb = $cursym.$goal;
if($new_value2<$goal) {
$redgreena = imagecolorallocate($im, 0, 205, 0);
} else {
$redgreena = imagecolorallocate($im, 255, 0, 0);
}
$string2a = “Donated : “;
$string2b = $cursym.$new_value2;
$red = imagecolorallocate($im, 255, 0, 0);
$string3a = “PayPal”;
$string3b = “Fees”;
$string3c = “:”;
$string3d = $cursym.$fees;
$left = $goal-$total;
$left = number_format($left, 2);
//$left = number_format($left, 2);
if(eregi(“-“,$left)) {
$redgreenb = imagecolorallocate($im, 0, 205, 0);
} else {
$redgreenb = imagecolorallocate($im, 255, 0, 0);
}
$string4a = “Left : “;
$string4b = $cursym.$left;
$string5a = $res.”%”;
$string5b = ” Of Our Goal”;
if($res<100) {
$redgreenc = imagecolorallocate($im, 255, 0, 0);
} else {
$redgreenc = imagecolorallocate($im, 0, 205, 0);
}
if($res<3) {
$string6 = “Donations Needed!”;
} elseif(($res<35) && ($res>=3)) {
$string6 = ” Getting There!”;
} elseif(($res<50) && ($res>=35)) {
$string6 = “Almost Half Way!”;
} elseif(($res<70) && ($res>=50)) {
$string6 = “Half Way There!”;
} elseif(($res<100) && ($res>=70)) {
$string6 = “Almost There Now!”;
} elseif($res>=100) {
$string6 = “We Did It YAY!”;
}
$px = (imagesx($im) – 21 * strlen($string5b)) / 2;
imagestring($im, 2, 13, 35, $stringa, $black);
imagestring($im, 2, 55, 35, $stringb, $green);
imagestring($im, 2, 13, 55, $string2a, $black);
imagestring($im, 2, 72, 55, $string2b, $redgreena);
imagestring($im, 2, 13, 75, $string3a, $black);
imagestring($im, 2, 13, 88, $string3b, $black);
imagestring($im, 2, 60, 78, $string3c, $black);
imagestring($im, 2, 72, 78, $string3d, $red);
imagestring($im, 2, 13, 108, $string4a, $black);
imagestring($im, 2, 54, 108, $string4b, $redgreenb);
imagestring($im, 2, $px, 128, $string5a, $redgreenc);
imagestring($im, 2, 44, 128, $string5b, $black);
imagestring($im, 2, 16, 148, $string6, $blue);
imagepng($im);
imagedestroy($im);
This successfully displays an image and puts a bit of text in it in places etc
However the script im creating has some more php code above this that includes a settings file and opens a database connection does some calculations based on the database contents etc
It successfully works on my own site but someone else who is using it is having problems and i cannot figure out why
If i use just the bit of code that generates the image it works fine, but if i have the include statement at the top i get the following error
[QUOTE]
Warning: Cannot modify header information – headers already sent by (output started at /home/content/etc/etc/etc/donationmeter/dbsettings.php:1) in /home/content/etc/etc/etc/test2.php on line 10
�PNG IHDR�J,� IDATH���}t�u’x�{U���$�dD���?Hdggc���b'{b���CV<1��d�xvp���dg����� ���$���G����<����h�ݑ��2��lGTb���o��@wU�w��q� ݍ��n�M�~���_U�WU]���ݯ�”E�?R�H�”E�?R�H�i�[})�������Ǭ����zz�|��}��Ȓ1�Zk�����٩��W��꫾���� H��9�����A�����?��A���׫W?�@L<��ٳg3�����k���y�”EW����#�ȑ#G^}��W�q�/�pa�X2� �1606b���l�#搸l�S�Tnܸq�������Go�m�i�?�^_��?�?�~�`�/h۶��l��4XǨ���”7�����u/–]�vm�?}�嗍1�z?w.:I��0��O����q�Mx�U���$^��/�������y�С��._����5�� vC8���<� ؛����f8�O<w��+�P�¿��O=��c�����؞{��f3�X “�y�@�L�� ���������C”��R����sϾ��x�C��v��������|>?66���gff���Baxxx“୷�*�Jug <��3�{������fff*^�ظ�귞yꩧ����Ν;�ڝ�d�r%@T��#sM�C�5ᳪ�FU%QAD@D� S���������
The settings file just contains a few lines of $somevariable = “Some content”;
Line 10 which it refers to in the error is the line starting header(
I have no idea why this script works on my site but not on this other persons site
I have checked evrything i can, both sites are hosted with godaddy on linux hosting with identical configurations from what i can tell
Can anyone shed any light on what is happening and why it is not working?
Thanks in advance