php-windows Digest 24 May 2004 07:22:59 -0000 Issue 2259
Topics (messages 23812 through 23816):
Re: Can someone tell me how to set an image transparent?
23812 by: Jeroen Serpieters
Re: Prevent error output from shell_exec
23813 by: Svensson, B.A.T. (HKG)
23814 by: Paul J. Smith
23815 by: Svensson, B.A.T. (HKG)
tgz files
23816 by: Ross Honniball
Administrivia:
To subscribe to the digest, e-mail:
[EMAIL PROTECTED]
To unsubscribe from the digest, e-mail:
[EMAIL PROTECTED]
To post to the list, e-mail:
[EMAIL PROTECTED]
----------------------------------------------------------------------
--- Begin Message ---
On Sun, 23 May 2004, Daniel Anderson wrote:
>
> The PHP Documentation is all well and good, but not one person on it is talking
> sense.
>
$color = imagecolorallocate( $img_resource, 255, 255, 255 ); // white
imagecolortransparent( $img_resource, $color );
Al you have to do is say which color you want to be transparent.
--
Jeroen
Anybody who thinks a little 9,000-line program [Java] that's distributed free and can
be cloned by anyone
is going to affect anything we do at Microsoft has his head screwed on wrong.
-- Bill Gates
--- End Message ---
--- Begin Message ---
The reason why popen() does not work for you is because you are calling
popen() with the wrong set of arguments.
You need to specify the they way you want to use the pipe.
You read a command just like a file, typically like:
$cmd = "dir *.txt 2>NUL"; // supress stderr
if ($pipe = popen($cmd, "r")) {
while (!feof($pipe)) {
// do your stuff
}
} else {
// if needed, do some error handling
}
USAGE:
According to the manual you can't use fread() with the popen():
"Returns a file pointer identical to that returned by fopen(), except that
it is unidirectional (may only be used for reading or writing) and must be
closed with pclose(). This pointer may be used with fgets(), fgetss(), and
fwrite()."
check out http://www.php.net/popen for details.
BIDIRECTIONAL COMMANDS:
As stated in the manual, you can only open the pipe for eitehr reading or
(an exlusive or) writing. Hence popen() will not help you here, in such case
you should use proc_open().
cheers
-----Original Message-----
From: Paul J. Smith
To: Svensson, B.A.T. (HKG)
Cc: [EMAIL PROTECTED]
Sent: 23-5-2004 0:15
Subject: RE: [PHP-WIN] Prevent error output from shell_exec
I'm calling ps_exec.
$handle = popen($cmd);
$read = fread($handle, 2096);
echo $read;
pclose($handle);
Does nothing whereas system($cmd) or shel_exec($cmd) works fine, apart
from the output. $read outputs nothing when I tested it. When calling
popen, can you pass program parameters such as "dir *.tmp /p" ? Maybe
this is why it's not working. The $cmd I call has rather a lot of
command line parameters to go with it.
-----Original Message-----
From: Svensson, B.A.T. (HKG) [mailto:[EMAIL PROTECTED]
Sent: 22 May 2004 22:59
To: '[EMAIL PROTECTED] '
Subject: RE: [PHP-WIN] Prevent error output from shell_exec
I can guarante you that popen() does work - I use it myself on a win2003
server. Since you can use shell_exec() I assume this has nothing to do
with safe_mode being switched on.
How do you call popen() ands what kind of dos program are you calling?
-----Original Message-----
From: Paul J. Smith
--- End Message ---
--- Begin Message ---
That did the trick.
Many thanks!
-----Original Message-----
From: Svensson, B.A.T. (HKG) [mailto:[EMAIL PROTECTED]
Sent: 23 May 2004 12:01
To: '[EMAIL PROTECTED] '
Subject: RE: [PHP-WIN] Prevent error output from shell_exec
The reason why popen() does not work for you is because you are calling
popen() with the wrong set of arguments.
You need to specify the they way you want to use the pipe.
You read a command just like a file, typically like:
$cmd = "dir *.txt 2>NUL"; // supress stderr
if ($pipe = popen($cmd, "r")) {
while (!feof($pipe)) {
// do your stuff
}
} else {
// if needed, do some error handling
}
USAGE:
According to the manual you can't use fread() with the popen():
"Returns a file pointer identical to that returned by fopen(), except
that
it is unidirectional (may only be used for reading or writing) and must
be
closed with pclose(). This pointer may be used with fgets(), fgetss(),
and
fwrite()."
check out http://www.php.net/popen for details.
BIDIRECTIONAL COMMANDS:
As stated in the manual, you can only open the pipe for eitehr reading
or
(an exlusive or) writing. Hence popen() will not help you here, in such
case
you should use proc_open().
cheers
-----Original Message-----
From: Paul J. Smith
To: Svensson, B.A.T. (HKG)
Cc: [EMAIL PROTECTED]
Sent: 23-5-2004 0:15
Subject: RE: [PHP-WIN] Prevent error output from shell_exec
I'm calling ps_exec.
$handle = popen($cmd);
$read = fread($handle, 2096);
echo $read;
pclose($handle);
Does nothing whereas system($cmd) or shel_exec($cmd) works fine, apart
from the output. $read outputs nothing when I tested it. When calling
popen, can you pass program parameters such as "dir *.tmp /p" ? Maybe
this is why it's not working. The $cmd I call has rather a lot of
command line parameters to go with it.
-----Original Message-----
From: Svensson, B.A.T. (HKG) [mailto:[EMAIL PROTECTED]
Sent: 22 May 2004 22:59
To: '[EMAIL PROTECTED] '
Subject: RE: [PHP-WIN] Prevent error output from shell_exec
I can guarante you that popen() does work - I use it myself on a win2003
server. Since you can use shell_exec() I assume this has nothing to do
with safe_mode being switched on.
How do you call popen() ands what kind of dos program are you calling?
-----Original Message-----
From: Paul J. Smith
--
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--- End Message ---
--- Begin Message ---
I know. ;)
-----Original Message-----
From: Paul J. Smith
To: Svensson, B.A.T. (HKG); [EMAIL PROTECTED]
Sent: 23-5-2004 14:38
Subject: RE: [PHP-WIN] Prevent error output from shell_exec
That did the trick.
Many thanks!
--- End Message ---
--- Begin Message ---
Hi all,
I'm hoping to install phpdocumentor which I have down-loaded as a 'tgz'
file to my windows machine. I'm not actually familiar with tgz files and
have no idea what I'm actually meant to do with it.
What does one do with a tgz file?
Ross
.
. Ross Honniball. JCU Bookshop Cairns, Qld, Australia.
.
--- End Message ---