473,657 Members | 2,507 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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($wi dth, $height);
$bck = ImageColorAlloc ate($im, 10,110,100);
$white = ImageColorAlloc ate($im, 255, 255, 255);
ImageFill($im, 0, 0, $bck);
ImageLine($im, 0, 0, $width, $height, $white);
for($i=0;$i<=29 9;$i=$i+10) {
ImageLine($im, 0, $i, $width, $height, $white); }
ImagePNG($im,"x .png");
?>

Aug 20 '07 #1
4 2184
VS
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
Aug 20 '07 #2
On Aug 20, 1:41 pm, push...@gmail.c om 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 cron
job.
<?php
//Header("Content-type: image/png");
$height = 300;
$width = 300;
$im = ImageCreate($wi dth, $height);
$bck = ImageColorAlloc ate($im, 10,110,100);
$white = ImageColorAlloc ate($im, 255, 255, 255);
ImageFill($im, 0, 0, $bck);
ImageLine($im, 0, 0, $width, $height, $white);

for($i=0;$i<=29 9;$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"?

Aug 20 '07 #3
Rik
On Mon, 20 Aug 2007 21:42:30 +0200, jdbartlett <co*****@jdbart lett.com
wrote:
On Aug 20, 1:41 pm, push...@gmail.c om 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 cron
job.
<?php
//Header("Content-type: image/png");
$height = 300;
$width = 300;
$im = ImageCreate($wi dth, $height);
$bck = ImageColorAlloc ate($im, 10,110,100);
$white = ImageColorAlloc ate($im, 255, 255, 255);
ImageFill($i m, 0, 0, $bck);
ImageLine($i m, 0, 0, $width, $height, $white);

for($i=0;$i<=2 99;$i=$i+10) {
ImageLine($i m, 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,di rname(__FILE__) ."/x.png");
--
Rik Wasmus
Aug 20 '07 #4
| (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.
Aug 22 '07 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
1342
by: El Durango | last post by:
any recommendations regarding a book that deals with PHP GD? thank you.
4
39467
by: Kevin | last post by:
Is there anyway to find out an image's DPI using GD? Can I change an image which is 300 DPI down to 200 DPI? I am fully aware of that DPI doesn't matter on screen, but these are to be used for printing, not web :) I read somewhere that you could do this: 200/300 = 0.667,
1
1939
by: chrisorto | last post by:
I have installed PHP 4.3.2, Apache 1.3.12, MySQL. I can't find the PHP GD module that supports PHP 4.3.2 on Red Hat Enterprise 3. Where can I get a package for php-gd-4.3.2 ?? I've looked like crazy and can't find a thing. Can you provide any help or suggestions? I am no very good at understanding modules and such. I have looked for this thing and can't
0
1812
by: fc | last post by:
Hallo, I'm using GD library in my web application to manage (resize, creating thumbnails etc.) images for a web site. My script works fine for most images but I've got a problem with some jpeg images, that are not recognized as valid jpeg images: getimagesize returns false, while using exif_read_data I get a warning like: "Error reading from file: got=xB6F2(=46834) != itemlen-2=xF2A7(=62119)"
0
1348
by: thunderscripts | last post by:
I have an illustrator CS file I have to use as a template to create an image using GD and PHP. This image will be used for print. Suppose I have some text at size 11pt in illustrator, which size should I use in imagettftext? (300/72)*11? Thanks Fede
1
2604
by: celery6541 | last post by:
Hi All, I was wondering if it was possible to insert an image on top of another image with php gd? I am using php gd to draw a diagram and I have some jpg/gifs that I want to also put inside of that diagram, is this possible? Thanks. -celery
0
1413
by: deerhack | last post by:
My english is very Bad xD. Well, How do rotate Image in the Plain X Y Z ? This is easy Using Studio Max , Sketup , Quark , etc ... But in Php and GD ?? Is it really better understand. 1.- Fisrt i have a Image (Texture) http://www.gratisweb.com/pepe_hack/jaja/textura.jpg
8
2618
by: brahmaforces | last post by:
Hi Folks, I am using cherrypy and python. I am trying to get a user profile image to resize on the client side before uploading to the server. PHP has a gd library that does it it seems. Has anyone done this in a python environment without uploading to the server?
19
3868
by: rsbgm | last post by:
Hi! I am using php5 extracted from the zip package downloaded from php.net. I have already set the php_gd2.dll extension at the php.ini as well as the extension_dir. However, I still get error undefined function everytime I use a GD function. I read that I have to configure php with GD support. How to do that with php5. I have also downloaded the GD lib but don't know how or what to do to configure it. Please advies. A novice PHP developer
0
8326
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8845
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8743
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8522
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8622
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6177
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4333
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2745
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1736
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.