<?php
session_start();
header("Content-type: image/png");
$img_handle = imageCreateFromPNG("bg2.PNG");
$q = rand(1,255);
$w = rand(1,255);
$e = rand(1,255);
$r = rand(1,255);
$t = rand(1,255);
$y = rand(1,255);
$u = rand(1,255);
$i = rand(1,255);
$color[0] = ImageColorAllocate ($img_handle, $q, 0, 100);
$color[1] = ImageColorAllocate ($img_handle, 200, 0, 0);
$color[2] = ImageColorAllocate ($img_handle, 0, $w, 100);
$color[3] = ImageColorAllocate ($img_handle, 200, 0, 0);
$color[4] = ImageColorAllocate ($img_handle, 0, $e, 100);
$color[5] = ImageColorAllocate ($img_handle, 200, 0, 0);
$color[6] = ImageColorAllocate ($img_handle, 0, $r, $y);
$color[7] = ImageColorAllocate ($img_handle, 0, $t, 100);
$color[8] = ImageColorAllocate ($img_handle, 200, 0, 0);
$color[9] = ImageColorAllocate ($img_handle, $u, $y, 100);
$color[10] = ImageColorAllocate ($img_handle, 200, 0, 0);
$color[11] = ImageColorAllocate ($img_handle, 0, $u, 100);
$color[12] = ImageColorAllocate ($img_handle, 0, $i, 100);
$rkey=trim($_SESSION['rkey']);
$characters=str_split($rkey);
$x=30;
$j=0;
for($i=0;$i<count($characters);$i++)
{
ImageString($img_handle, 5, $x, 13, $characters[$i], $color[$j]);
$x=$x+7;
$j=$j+1;
if($j==13)
$j=0;
}
ImagePNG($img_handle);
$img_handle = $_SESSION['img'];
ImageDestroy($img_handle);
?>
okay guys above is my code. I would like to know if there is any way to write out the image created into a .png file in my root folder?. The image is generated fine but i cant seem to find a .png file anywhere. Any thoughts?.
Thanks
Danny