Page 1 of 1

How do I use gd that comes with PHP?

Posted: Wed May 07, 2003 7:02 pm
by scr0p
I cant use imagegif() function (I read about what happened with gif format), but that is all my book has examples with, what other functions do I use to show as JPG or PNG?

Code: Select all

<?php
	$id = imagecreate(200, 200 );
	print $id; //this works, but after this, how do I show the 200x200 box
?>
<html>
<head>
<title> .:DynaMo` grafX:. </title>
</head>
<body>
	<img src="grafx.php" alt="PHP generated">
</body>
</html>

Posted: Wed May 07, 2003 8:20 pm
by m3mn0n
windows php.ini wrote: extension=php_gd.dll
That's presuming you have windows and the gd libraryinstalled with php.

Check out http://www.php.net/gd for further reference.

Posted: Thu May 08, 2003 5:33 am
by Wayne

Code: Select all

ImagePNG($id);
But this out puts an image with image headers so you cannot call it from with a php script. You will need to do something like this, create a script that will only output your image and then call that script as you would a normal image.


Code: Select all

<HTML>
<BODY>
some text here! 
and the image here!
<img src="draw_pic.php">
</BODY>
</HTML>

Re: How do I use gd that comes with PHP?

Posted: Fri May 09, 2003 1:19 am
by m3mn0n
Yea i noticed that too. =P

I suggest using an external file for creation also.