php-windows Digest 14 Mar 2003 06:36:45 -0000 Issue 1633
Topics (messages 18993 through 19001):
Re: Problem with exec(). Help needed!
18993 by: Rich Gray
18994 by: P.Gertman.informgaz.gazprom.ru
cropping an image script
18995 by: Anthony Ritter
Conversion SVG --> JPEG
18996 by: TRIBOLLET R�gine
dl() doesn't work . PHP 4.3.1 + Apache 1.3 + Win2k.
18997 by: Diego Fulgueira
Help with sending mail
18998 by: freeman
19001 by: Manuel Lemos
Re: Connections in SQL Server
18999 by: Diego Fulgueira
Sending mail on Windows 98
19000 by: Geoff Ogilvy
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 ---
> >Can you not use ODBC to connect to the Progress database? It
> will probably
> >be simpler than an exec() call... but anyway if your Progress script is
> >returning data that PHP needs to parse then try using passthru()
> instead...
> Thanks! i'll try passthru() right now.
>
> <?php
> require_once("webdoc_cfg.php");
> $fname="D:/htdocs/p/php_test_make_res.p";
> $p_code_test='{utils.i}
> writeln("<?php").
> writeln("$zzz=42;").
> writeln("echo ~"in PROGRESS zzz=$zzz~";").
> writeln("?>").';
> if(!$fp = fopen($fname, 'w'))
> {
> print "Cannot open file ($fname)";
> exit;
> }
> if (!fwrite($fp,$p_code_test))
> {
> print "Cannot write to file ($fname)";
> exit;
> }
> fclose($fp);
> passthru($_pro.' -U ******** -P ********* -p '.$fname,$pro_code2);
> echo "zzz=$zzz";
> ?>
>
> hm... it does not work!
> output of command called with passthru() is NOT parsed by PHP.
> so i get in my browser just the same bla-bla that my PROGRESS script
> generates:
> ==========================
> <?php
> $zzz=42;
> echo "in PROGRESS zzz=$zzz";
> ?>
> zzz=
> ==========================> from browser's "view source"
> Of course i can use ODBC. But ODBC driver for PROGRESS seems to
> be a really
> odd and slow thing.
But that is what passthru() does it just returns the output into your script
as raw data i.e. it is not parsed by the interpreter. You can try setting
the output of passthru() to a variable then parse the variable contents
accordingly - eval() will be your friend in that process...Anyway, I'm not
sure the method you are using is the best way forward when compared to
ODBC - these people have successfully used PHP with Progress (via ODBC of
course) http://www.newnhams.com
Rich
--- End Message ---
--- Begin Message ---
Thank you, Rich!
www.newnhams.com is great.
BTW, their class proPHP uses the same approach as me.
So i'll keep on trying.
Happy hacking!
--- End Message ---
--- Begin Message ---
In the following php script, the function takes the original file and crops
to the destination file.
I've ran the script using a .png file and a .jpg file.
The .png works fine whereas the .jpeg file returns only part of the image
along with a blue rectangle.
For instance - where the original image is a 200 x 300 jpeg called:
1_data.jpeg
and the destination iamge is 75x75 called:
2_data.jpeg
and starting at the x,y coordinates of 0,0 - the script returns a 75x 75
file but only a sliver of the .jpg image is within the 75x75 blue square.
Any help will be of assistance.
Thank you.
Tony Ritter
........................................................
The following is the php cropping script (with author credit):
<?
//
// image crop fuction ..... [EMAIL PROTECTED]
// info at http://obala.net/en
//
// Yes the proses could be executed with imagecopyresized build-in function
// but with this function you get the idea of how an image color set is
constructed
//
// $cropX = source starting X
// $cropY = source starting Y
// $cropW = crop weigth
// $cropH = crop heigh
// $source = source filename
// $destination = destination filename
// $type = image type
function
im_crop($cropX,$cropY,$cropH,$cropW,$source,$destination,$type='jpeg') {
// switch known types and open source image
switch ($type) {
case 'wbmp': $sim = ImageCreateFromWBMP($source); break;
case 'gif': $sim = ImageCreateFromGIF($source); break;
case 'png': $sim = ImageCreateFromPNG($source); break;
default: $sim = ImageCreateFromJPEG($source); break;
}
// create the destination image
$dim = imagecreate($cropW, $cropH);
// pass trought pixles of source image
for ( $i=$cropY; $i<($cropY+$cropH); $i++ ) {
for ( $j=$cropX; $j<($cropX+$cropW); $j++ ) {
// get RGB color info about a pixel in the source image
$color = imagecolorsforindex($sim, imagecolorat($sim, $j, $i));
// insert the color in the color index of the new image
$index = ImageColorAllocate($dim, $color['red'],
$color['green'], $color['blue']);
// plots a pixel in the new image with that color
imagesetpixel($dim, $j-$cropX, $i-$cropY, $index);
}
}
// whe dont need the sorce image anymore
imagedestroy($sim);
// switch known types and save
switch ($type) {
case 'wbmp': ImageWBMP($dim, $destination); break;
case 'gif': ImageGIF($dim, $destination); break;
case 'png': ImagePNG($dim, $destination); break;
default: ImageJPEG($dim, $destination); break;
}
// free the used space of the source image
imagedestroy($dim);
}
// example
im_crop(0,0,75,75,'1_data.jpeg','2_data.jpeg','jpeg');
?>
--- End Message ---
--- Begin Message ---
Hello,
I must, in a PHP script, convert a SVG document in a JPEG picture.
Do you know how I can do that.
Thanks a lot.
R�gine
--- End Message ---
--- Begin Message ---
Hope to find someone to help me with this:
I am trying to load a dynamic extension using the dl() function. The dll file resides
in my web root directory (c:\inetpub\wwwroot). I have extension_dir = ./ in php.ini
(the default).
dl("xxxx_php.dll") doesn't seem to find the file when called from a script that
resides in the same directory as the extension file (xxxx_php.dll). Also, I've tried
setting extension_dir = c:\inetpub\wwwroot without success.
Any ideas, please?
Thanks in advance.
--- End Message ---
--- Begin Message ---
my mail server doesnt want to keep working, is there a way to set the mail server
within the script, this is for a unix machine.
Thanks for any help.
--- End Message ---
--- Begin Message ---
Hello,
On 02/18/2003 04:21 PM, Freeman wrote:
my mail server doesnt want to keep working, is there a way to set the mail server within the script, this is for a unix machine.
No, if PHP is running under Unix, the mail function will not use the
SMTP server.
In that case you may want to try this class that comes with a sub class
for sending via SMTP in any platform. It also comes with a function
named smtp_mail() that emulates the mail() function in case you need it:
http://www.phpclasses.org/mimemessage
You also need this other class to do the actual delivery via SMTP:
http://www.phpclasses.org/smtpclass
--
Regards,
Manuel Lemos
--- End Message ---
--- Begin Message ---
I have exactly the same configuration as you do, except for the fact that I
use PHP as an Apache module and not as CGI. I have no problems at all.
Running PHP as an Apache module and it is more efficient than the CGI
version.
On the other hand, there are other several things you can try:
1. Use mssql_get_last_message() to make sure that the error is not being
generated at ths SQL Server.
2. Use one connection for each query, closing all your cursors and
connections before opening a new one.
3. If nothing seems to work, this code will help:
/*1. Hide warnings*/
error_reporting(E_ALL & ~E_WARNING);
/*2. Run query twice before giving up with an error message*/
mssql_query($myQuery) or msssql($myQuery) or die("Query Failed: " .
$myQuery . "<br>" . mssql_get_last_message());
/*3. Turn warnings back on */
error_reporting(E_ALL);
That way, you will avoid all warning messages, and will run twice the query
that produces a warning, halting execution if an erro occurs.
Cheers. PD: Eres mexicano?
--- End Message ---
--- Begin Message ---
Summary : do I have an MTA ?
Detail : Some scripts are being developed in php for uploading to a web host
and I would like to test them on my standalone Windows 98 machine at home. I
have Apache 2.0.44, PHP 4.3.0 and a dial-up connection to an ISP, which we
will call ispname, for e-mail.
The PHP manual states " The Windows implementation of mail() differs in many
ways from the Unix implementation. First, it doesn't use a local binary for
composing messages but only operates on direct sockets which means a MTA is
needed listening on a network socket (which can either on the localhost or a
remote machine)."
My php.ini file includes SMTP = smtp.ispname.com and smtp_port = 25 although
I have also tried various other possibilities. In all cases, when mail() is
called, the browser hangs up. I was rather hoping the Dial-Up Connection
pop-up box would be displayed. I'm not sure whether this is a software
problem, e.g. with the software versions I'm runnning on Windows 98, perhaps
the need to use an older Apache 1.3, or whether the ISP software simply does
not provide an MTA. (I also have AOL if that is of any relevance.) I see
that there is a file sendmail.dll in C:\Windows\System.
If I need an MTA, are any available as open source ?
As you can see, there is a gap in my knowledge.
Thanks for your help.
Geoff
--- End Message ---