ashraful haque - 2009-02-26 01:49:27
My code is as below
<?php
// Create a 200 x 200 image
$recwidth=550;
$recheight=300;
$canvas = imagecreate($recwidth, $recheight+30);
// Allocate colors
$white = imagecolorallocate($canvas, 255, 255, 255);
$red = imagecolorallocate($canvas, 255, 0, 0);
function rec($startx, $starty, $endx, $endy){
imagerectangle($canvas, $startx, $starty, $endx, $endy, $black);
}
rec(20,100,500,290);
// Output and free from memory
header('Content-Type: image/jpeg');
imagejpeg($canvas);
imagedestroy($canvas);
?>
but if I make rec function as below
function rec($canvas, $startx, $starty, $endx, $endy, $black){
imagerectangle($canvas, $startx, $starty, $endx, $endy, $black);
}
then It works well. Why?