|
Posted by Rik on 08/20/07 19:46
On Mon, 20 Aug 2007 21:42:30 +0200, jdbartlett <contact@jdbartlett.com> =
=
wrote:
> On Aug 20, 1:41 pm, push...@gmail.com wrote:
>> I'm trying to run the following php code along with gd library as a
>> cron job ,but cron is not generating any output.
>> When I run this code from my browser I get an image correctly.
>> Somebody please tell me what needs to be done to get an image via cro=
n
>> job.
>> <?php
>> //Header("Content-type: image/png");
>> $height =3D 300;
>> $width =3D 300;
>> $im =3D ImageCreate($width, $height);
>> $bck =3D ImageColorAllocate($im, 10,110,100);
>> $white =3D ImageColorAllocate($im, 255, 255, 255);
>> ImageFill($im, 0, 0, $bck);
>> ImageLine($im, 0, 0, $width, $height, $white);
>>
>> for($i=3D0;$i<=3D299;$i=3D$i+10) {
>> ImageLine($im, 0, $i, $width, $height, $white); }
>>
>> ImagePNG($im,"x.png");
>> ?>
>
> Does the user with this cron job have permission to create/overwrite
> the file "x.png"?
>
And keep in mind that often the working directory is wherever the cronjo=
b =
started, NOT the directory of the script itself. You might want to try:
ImagePNG($im,dirname(__FILE__)."/x.png");
-- =
Rik Wasmus
Navigation:
[Reply to this message]
|