|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Generating graphics
I need to learn to create graphics on the fly in php4.2.2 so I decided to start by trying to draw a simple line.
I have not had much success. I have listed the code below. If I include the header, I get an error message that says: "Cannot add header information - headers already sent by (there is a line reference here for the line that says <?php)" However, if I don't include the header I get a white page with nothing on it and no errors are generated. I am a newbie and have no experience with graphics. Can someone please give me a few pointers? I have referred to php.net but I am confused by the advice as it covers so many different versions of php. My end goal is to draw graphs with data on dynamic pages using data from a mySQL Table. Any advice would be greatly appreciated! Here is the code: <?php Header ("Content-type: image/jpeg"); $image = @imagecreate(200,150) or die ("Cannot Initialize new image stream!"); $gray = ImageColorAllocate($image,204,204,204); $blue = ImageColorAllocate($image,0,0,255); ImageLine($image,10,10,15,30,$blue); ImageJPEG($image); ImageDestroy($image); ?> Thank you! |
|
#2
|
|||
|
|||
|
RE: Generating graphics
Look ok..just make sure there is no whitespace before the first <? ...no spaces, new lines or anything....
|
|
#3
|
|||
|
|||
|
RE: Generating graphics
There is no whitespace, etc. But still no results.
Can you think of anything else that might be causing the problem? thanks |
|
#4
|
|||
|
|||
|
RE: Generating graphics
When I run this code here, it runs perfectly. What version of PHP are you using? Can you provide a link to the page that is not working?
|
|
#5
|
|||
|
|||
|
RE: Generating graphics
do you have the GD library installed?
|
![]() |
| Viewing: Codewalkers Forums > PHP Related > PHP Coding > Generating graphics |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|