The "Freeola Customer Forum" forum, which includes Retro Game Reviews, has been archived and is now read-only. You cannot post here or create a new thread or review on this forum.
$values = array(
0 => $a_x, // x1
1 => $a_y, // y1
2 => $b_x, // x2
3 => $b_y, // y2
4 => $c_x, // x3
5 => $c_y, // y3
6 => $d_x, // x4
7 => $d_y, // y4
);
$im = imagecreate(500, 500);
$bg = imagecolorallocate($im, 255, 255, 255);
$blue = imagecolorallocate($im, 0, 0, 255);
imagefilledpolygon($im, $values, 4, $blue );
?>
But surprise, surprise, it doesn't work for me. I don't get any error messages though. Any ideas?
> Yeah, I changed the colours around on purpose just to make sure that
> the imagecreate was working. It doesn't matter about that for now.
> When assigning the variables, can it be done straight from the posted
> form, or do I need to post to another variable and then use that
> within the array?
Well, you need to post the variables to image.php, something like
(of course with all your vars)
I don't need to "print" the variables, do I?
In your image.php file how are the values in the array being assigned? At the moment, they map to variables, $a_x, $a_y etc. but you're not showing any assignment of them. The array itself is fine, and you are using it in the right manner with ImageFilledPolygon. If you replace $a_x etc. with your own numbers, it does work so presumably your variables aren't being assigned.
Header ("Content-type: image/png");
$values = array(
0 => $a_x,
1 => $a_y,
2 => $b_x,
3 => $b_y,
4 => $c_x,
5 => $c_y,
6 => $d_x,
7 => $d_y, );
$im = Imagecreate(500, 500);
$bg = ImageColorAllocate($im, 0, 0, 255);
$blue = ImageColorAllocate($im, 255, 255, 255);
ImageFilledPolygon($im, $values, 4, $blue );
ImagePng ($im);
ImageDestroy ($im); ?>
Then a php file that has the content "
But I still get just a blue box, which leads me to deduce, with my Columbo-esque superpowers that it's something to do with how the variables are being fed through. Can anyone see a problem with what I'm doing for the array?
The code to create the image should be in a separate file called image.php or whatever, which should then be called via an image link in the page you want it displayed on e.g.
0 => $a_x,
1 => $a_y,
2 => $b_x,
3 => $b_y,
4 => $c_x,
5 => $c_y,
6 => $d_x,
7 => $d_y, );
$im = Imagecreate(500, 500);
$bg = ImageColorAllocate($im, 255, 255, 255);
$blue = ImageColorAllocate($im, 0, 0, 255);
ImageFilledPolygon($im, $values, 4, $blue );
ImagePng ($im);
ImageDestroy ($im);
?>
">
All the breaks are taken out in the uploaded code, so it's one big line of text. I get a broken image and still gibberish underneath. Is there anything wrong with the fundamentals of this, or is it something secret that only FREEOLA would know?