Dear sir.. I have written the following code and it runs perfectly when i save the location of the image a.jpg in a FAT (non NTFS partition). else i get the
error
Warning: imagejpeg: unable to open 'd:\inetpub\wwwroot\kirths\temp\a.jpg' for writing in d:\inetpub\wwwroot\Kirths\RBarFile.php on line 52
I believe that i have to set NTFS permissons to the folder or for the software.
I am using windows 2000 Advance server and am running PHP4.05 and IIS ..
Please help me and advise on how to set the directory permissions.
Here is a sample of the code:--
<?php
//graph diagram:-
//Header("Content-type: image/jpeg");
// I have taken 'TWO' variables for better readability.
$row=300;
$col=2*$row;
$image = ImageCreate($col,$row);
//***Colours Used:-
$gray = ImageColorAllocate($image,220,220,220);
$red = ImageColorAllocate($image,255,0,0);
$blue = ImageColorAllocate($image,0,0,250);
$green = ImageColorAllocate($image,0,250,0);
$lightGreen = ImageColorAllocate($image,200,250,200);
$black = ImageColorAllocate($image,0,0,0);
//**Y Axis:-
ImageLine($image,(0.1$col),(0.9$row),(0.1$col),(0.1$row),$black);
//ImageLine($image,(0.08$col),(0.12$row),(0.1$col),(0.1$row),$black);
ImageLine($image,(0.09$col),(0.12$row),(0.1$col),(0.1$row),$black);
ImageLine($image,(0.1$col),(0.1$row),(0.11$col),(0.12*$row),$black);
//Opening Data File:-
$dfile = "D:\Inetpub\wwwroot\Kirths\Text Files\BarData.txt";
if(!($df = fopen($dfile,"r"))) die ("Cannot open data file.");
//**Bars on X Axis:-
$tcol = 0.2;
$bcol = 0.22;
While(!(feof($df)))
{
$data=(int)fgets($df,4);
$barLen=$row-($data/100$row)-(0.1$row);
ImageFilledRectangle($image,($tcol$col),($barLen),($bcol$col),(0.9$row),$red);
$tcol += 0.1;
$bcol += 0.1;
}
fclose($df);
// RK : commented out the following
//$string = "Rubix Infotech Inc.";
//ImageString($image,5,200,10,$string,$blue);
//**X Axis:-
ImageLine($image,(0.1$col),(0.9$row),(0.9$col),(0.9$row),$black);
ImageLine($image,(0.89$col),(0.88$row),(0.9$col),(0.9$row),$black);
ImageLine($image,(0.89$col),(0.92$row),(0.9$col),(0.9*$row),$black);
//***Display Image:-
ImageJPEG($image,"d:\inetpub\wwwroot\kirths\temp\a.jpg");
ImageDestroy($image);
?>
<H1><center>RUBIX Information Technologies, Inc</center></H1>
<H2><center>Data logging report</center></H2>
<center>
<image src="d:\inetpub\wwwroot\kirths\temp\a.jpg"></img>
</center>
<BR>
<image src="d:\inetpub\wwwroot\kirths\temp\a.jpg"></img>