Edit report at https://bugs.php.net/bug.php?id=29033&edit=1

 ID:                 29033
 Comment by:         goshawngo at hotmail dot com
 Reported by:        robotech at mixmail dot com
 Summary:            GD had problems with "include" keyword
 Status:             Not a bug
 Type:               Bug
 Package:            Unknown/Other Function
 Operating System:   Linux
 PHP Version:        4CVS-2004-07-06 (stable)
 Block user comment: N
 Private report:     N

 New Comment:

In response to derek,

i have tried using include or require and they both keep breaking my page and 
it says "The image cannot be displayed because it contains errors."

Is there anyway to use include?

Here is my code

<?php
header("Content-type: image/jpg");
include "psnvars.php";
$string = "em...@example.com";
$font  = 4;
$width  = ImageFontWidth($font) * strlen($string);
$height = ImageFontHeight($font);
$im = @imagecreatetruecolor ($width,$height);
$background_color = imagecolorallocate ($im, 255, 255, 255);
$text_color = imagecolorallocate ($im, 255, 255, 255);
imagestring ($im, $font, 0, 0,  $string, $text_color);
imagejpeg ($im);
?>

If i remove include "psnvars.php"; it starts working again


Previous Comments:
------------------------------------------------------------------------
[2004-07-06 20:25:58] der...@php.net

Sorry, but your problem does not imply a bug in PHP itself.  For a
list of more appropriate places to ask for help using PHP, please
visit http://www.php.net/support.php as this bug system is not the
appropriate forum for asking support questions. 

Thank you for your interest in PHP.

You probably have trailing or tailing whitespace in the include file.

------------------------------------------------------------------------
[2004-07-06 17:34:38] robotech at mixmail dot com

Description:
------------
I'm using GD to generate a dinamic image showing a chart.
It sees that there's and error when I try to use the keyword "include". 
I also try to use an empty file using the keyword "include" and the result it's 
the same.

Reproduce code:
---------------
/*************/
/* chart.php */
/*************/
Header ("Contect-type: image/jpeg");
include ("function.phtml"); //only a group of functions. They all work.
$imgW = 500; $imgH = 312;
$img = ImageCreate($imgW,$imgH);
$black = ImageColorAllocate($img,0,0,0);
$white = ImageColorAllocate($img,255,255,255);
ImageFilledRectangle($img,0,0,$imgW,$imgH,$white);
$font = 2;
$txt = "Hello, dude!";
ImageString($img,$font,100,100,$txt,$black);
ImageJPEG($img);
ImageDestroy($img);


Expected result:
----------------
If would like to reuse a same code inside function.phtml in all my dinamic 
charts.

Actual result:
--------------
It isn't working. Only works when I exclude the include.


------------------------------------------------------------------------



-- 
Edit this bug report at https://bugs.php.net/bug.php?id=29033&edit=1

Reply via email to