cron not working with php+gd | | |
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 cron
job.
<?php
//Header("Content-type: image/png");
$height = 300;
$width = 300;
$im = ImageCreate($width, $height);
$bck = ImageColorAllocate($im, 10,110,100);
$white = ImageColorAllocate($im, 255, 255, 255);
ImageFill($im, 0, 0, $bck);
ImageLine($im, 0, 0, $width, $height, $white);
for($i=0;$i<=299;$i=$i+10) {
ImageLine($im, 0, $i, $width, $height, $white); }
ImagePNG($im,"x.png");
?> | | | | re: cron not working with php+gd
At a Guess I'd say you need to find a way of making cron generate an
email with the image as an attachment, but quite how you go about that I
really don't know. (cron usually only deals with text).
--
VS | | | | re: cron not working with php+gd
On Aug 20, 1:41 pm, push...@gmail.com wrote: Quote:
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 cron
job.
<?php
//Header("Content-type: image/png");
$height = 300;
$width = 300;
$im = ImageCreate($width, $height);
$bck = ImageColorAllocate($im, 10,110,100);
$white = ImageColorAllocate($im, 255, 255, 255);
ImageFill($im, 0, 0, $bck);
ImageLine($im, 0, 0, $width, $height, $white);
>
for($i=0;$i<=299;$i=$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"? | | | | re: cron not working with php+gd
On Mon, 20 Aug 2007 21:42:30 +0200, jdbartlett <contact@jdbartlett.com
wrote: Quote:
On Aug 20, 1:41 pm, push...@gmail.com wrote: Quote:
>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 cron
>job.
><?php
>//Header("Content-type: image/png");
>$height = 300;
>$width = 300;
>$im = ImageCreate($width, $height);
>$bck = ImageColorAllocate($im, 10,110,100);
>$white = ImageColorAllocate($im, 255, 255, 255);
>ImageFill($im, 0, 0, $bck);
>ImageLine($im, 0, 0, $width, $height, $white);
>>
>for($i=0;$i<=299;$i=$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 cronjob
started, NOT the directory of the script itself. You might want to try:
ImagePNG($im,dirname(__FILE__)."/x.png");
--
Rik Wasmus | | | | re: cron not working with php+gd
| (cron usually only deals with text).
wtf!?
cron is only responsible for initiating executables at given times. the only
time cron has anything to do with text is when it gives you vi to edit a
cron in response to 'cron -e'. even then, it's vi at work. |  | | | | /bytes/about
We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights.
Get the best answers to your questions from over 226,295 network members.
|