Hi,
I have been practising with the gd after I got it implemented
(thanks for your helps).
But i must be doing something wrong because it does’t seem to work that well !
Here is my coding:
I got the function from php manual which is very neat !
<?php
function fromhex($string){
GLOBAL $img1;
sscanf($string, “%2x%2x%2x”, $red, $green, $blue);
return ImageColorAllocate($img1,$red,$green,$blue);
}
$img1 = imagecreate(400,500);
$words = “No Photo”;
imageRectangle( $img1, 40,40,150,150, fromhex(‘000000’) );
imageFilledRectangle ( $img1, 250, 350, 300, 400,fromhex(’77bb99′));
imageLine ($img1, 20,130, 300, 150,fromhex(‘000000’) );
imageEllipse( $img1, 300, 200, 120, 40,fromhex(‘fff444’));
imageString ( $img1, 200, 50,5, $words,fromhex(‘660044’));
header(“Content-type: image/jpeg”);
imagejpeg($img1);
imageDestroy($img1);
?>
The problems I am having are:
1) imageRectangle command just puts the color into the whole image and I don’t get
any rectangle.
2) imageString is supposed to draw the text according to the font size, in this case 5, but it is no bigger than when I put 2 in that place.
3) when I try to save the file using imagejpeg($img1, xxx.jpeg, 100);
I get a message saying that my image has errors – but it display ok if i output it directly to the screen.
Any help is most appreciated.
Thanks
David.