Page 1 of 1
Need Immediate help for PHP assignment
Posted: Wed Oct 17, 2007 2:10 am
by arjumand
***** Please use a descriptive title and include specifics in your question. *****
***** Double posting is against forum rules *****
I am a newbie in PHP programming. I have been given an assignment by my teacher and that is to make lone drawings thru php code.I am using Easyphp 1.8 and I need help on as to how this should be done.
Posted: Wed Oct 17, 2007 2:21 am
by Josh1billion
"lone drawings"??
You mean you want to generate images? If so, you will need to first make sure you have the GD library/extension installed/enabled, then have a look at
http://www.phpgd.com for some tutorials.
Posted: Wed Oct 17, 2007 2:50 am
by arjumand
feyd | Please use 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]
Yes I mean image generation.............I am trying the following code but its not working.What should I do
Code: Select all
<?php
//draw1.php
Header("Content-type: image/jpeg");
$image = ImageCreate(200,150);
$gray = ImageColorAllocate($image,204,204,204);
$blue = ImageColorAllocate($image,0,0,255);
ImageLine($image,10,10,150,30,$blue);
ImageJPEG($image);
ImageDestroy($image);
?>
Furthermore how should I enable the GD library.
feyd | Please use 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]
Posted: Wed Oct 17, 2007 4:06 am
by Josh1billion
You should put php tags around your code to make it easier to read, like this but without the dashes: [p-h-p] code here [/p-h-p]
Furthermore how should I enable the GD library.
Your host will have to enable this, but most hosts do already have it enabled so you shouldn't have much to worry about. But if your page says "Fatal error: undefined function ImageCreate()", that means it's not enabled.
Yes I mean image generation.............I am trying the following code but its not working.What should I do
What's the problem? I tested it out right here and it worked fine. Like I said above, if it says that the ImageCreate() function is not defined, that means the GD library isn't enabled, so you'll have to enable that. If that's not the error message you're getting, then you'll have to post the error message you
are getting so that we know what the problem is.
