Jump to content

Recommended Posts

 

can i create an image(or a grafic) with only php? i'm reading in my book that i need pearl;

 

 

<?php

$width = 34*M_PI;

$height = 110;

$img = imagecreate($width,$height);

$background = imagecolorallocate($img,200 ,200 ,200);

$black = imagecolorallocate($img, 0 , 0, 0);

$interval = 2*M_PI;

for ($i=0; $i <$interval; $i+=0.01)

 

{  $m = 5 + (( $width/(2*M_PI)-2))*$i;

  $n= 5 + ($height/2-5)*(1-sin($i));

 

imagesetpixel ($img, $m, $n, $black);

}

 

 

header("Content-type: image/png");

imagepng($img);

imagedestroy($img);

?>

 

 

 

 

i get this error: Fatal error: Call to undefined function: imagecreate() in c:\program files\easyphp1-8\www\tabel.php on line 4

Link to comment
https://forums.phpfreaks.com/topic/87180-solved-generating-grafic/
Share on other sites

That code generates a sine wave OK.

 

You need to to edit your php.ini file and remove the ";" from the beginning of the line

;extension=php_gd2.dll

 

and make sure that dll is your folder with the other extensions.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.