***** 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.
Need Immediate help for PHP assignment
Moderator: General Moderators
- Josh1billion
- Forum Contributor
- Posts: 316
- Joined: Tue Sep 11, 2007 3:25 pm
"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.
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.
feyd | Please use
Furthermore how should I enable the GD library.
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]
Yes I mean image generation.............I am trying the following code but its not working.What should I doCode: 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);
?>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]- Josh1billion
- Forum Contributor
- Posts: 316
- Joined: Tue Sep 11, 2007 3:25 pm
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]

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.Furthermore how should I enable the GD library.
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.Yes I mean image generation.............I am trying the following code but its not working.What should I do