Hi,
I am trying to get image manipulation to work in PHP, but I'm not very good at it and was wondering if someone here could hlpe me!
Here's the code I made up last night by hacking together a few scripts I found on the net. Basically I want to have a random string of words appear in this picture:
http://www.ruds.co.uk/mike/banner/random.gif
heres the code I am using at the moment
<?php
$textfile ="banner/who.txt";
$textfile1 = "banner/verbs.txt";
$textfile2 = "banner/objects.txt";
$who = file("$textfile");
$what = file("$textfile1");
$with = file("$textfile2");
$who1 = rand(0, sizeof($who)-1);
$what1 = rand(0, sizeof($what)-1);
$with1 = rand(0, sizeof($with)-1);
$string = "$who[$who1] $what[$what1] $with[$with1]";
$id = ImageCreateFromGif("banner/random.gif");
$yellow = ImageColorAllocate($id, 255, 255, 0);
$white = ImageColorAllocate($id, 255, 255, 255);
$black = ImageColorAllocate($id, 0, 0, 0);
ImageString($id, 4, 10, 20, strtoupper($string."!"), $black);
ImageGif($id,"./newmonkey.gif");
?>
<img src="newmonkey.gif" border=0>
Also I was unsure on how to actually call this code from within the page the image needs to be displayed on.
And if someone can think of a better way of creating the word I would be grateful to find out how cause I'm not very good and the textfile seemed like the easiest thing to do, although it can give some pretty poor results.
Many Thanks
Mike
P.S I am extremly new to PHP, so any help would be greatfully recieved!