imagecreate(); [solved]
Posted: Wed Mar 15, 2006 3:53 pm
I’m really excited about making images on the fly. From a couple tutorials here is the code I came up with:
When I run the script I receive the following error:
Thanks.
[edit]
Viewing the page in IE, I receive the following error:
Code: Select all
<?php
header("Content-type: image/png");
$image['height'] = 50;
$image['width'] = 200;
$image['bgcolor'] = imagecolorallocate($img, 0, 0, 0);
$image['textcolor'] = imagecolorallocate($img, 204, 204, 204);
$image['textsize'] = 12;
$image['text'] = 'testing';
$img = imagecreate($image['height'], $image['width']);
imagefill($img, 0, 0, $image['bgcolor']);
imagestring($img, $image['textsize'], 5, 5, $image['text'], $image['textcolor']);
imagepng($img);
?>I know I haven’t specified a font, I am wondering if that could be the culprit?The image “URL” cannot be displayed, because it contains errors.
Thanks.
[edit]
Viewing the page in IE, I receive the following error:
<br />
<b>Warning</b>: imagecolorallocate(): supplied argument is not a valid Image resource in <b>/home/theelite/public_html/members/includes/image.php</b> on line <b>6</b><br />
<br />
<b>Warning</b>: imagecolorallocate(): supplied argument is not a valid Image resource in <b>/home/theelite/public_html/members/includes/image.php</b> on line <b>7</b><br />
‰PNG
IHDR2È