Hi All,
Im very new to PHP, and dont know whether to put this in the newbies section of the code problems section... but here goes.
Im running "Apache/1.3.23 (Win32) PHP/4.1.1" with the gd lib's working. (Tried some sample code to verify this). From a book that I bought, it seems this code should produce a gif called wind.gif in my root or c:\ dir. Even the code directly from the book doesnt work. I have striped out all the unnecessary code (connecting to a DB and that), I want to create a jpg from a DB that I have and then display it as part of a web page. Any and all suggestions greatfully received. If I get it working ill put it in a function, so the jpg and location can be put dynamically into a calling page.
Code is below:
Thanks for the help!
Gaz.
<?php
Header("Content-type: image/gif");
$imagefile = "C:\WIND.GIF";
/ create and view image /
$image = imagecreate(200,200);
//Allocate different colours
$black = imagecolorallocate($image, 0, 0, 0);
$white = imagecolorallocate($image, 255, 255, 255);
$green = imagecolorallocate($image,200,100,0);
//Draw an ellipse
imagearc($image, 100, 100, 198, 188, 1, 360, $white);
//Creates the N, S, E, W on the Clock:
imagechar($image,5,100,0,N,$green);//north
imagechar($image,5,100,180,S,$green);//south
imagechar($image,5,10,95,E,$green);//East
imagechar($image,5,190,95,W,$green);//West
//This calls the correct direction for the Hand on the Clock for the wind Direction.
imageline($image,100,100,0,-20000,$green);
//print and then close the image
imagegif($image, $imagefile);
echo $imagefile;
?>