Re: [PHP] crop an image

2007-11-06 Thread Chris Bruce
Does anyone have some insight here? I am trying to crop an image. The  
crop seems to almost work, but I get black bars on the image. Has  
anyone had any experience with cropping images using the GD library?


Thanks.

Chris

On Nov 2, 2007, at 5:41 PM, Chris Bruce wrote:

What was the solution here? I am trying to crop but am getting a  
black bar the same height as the crop at top. For this image I want  
to crop 40 pixels off of the top:


$image_p = imagecreatetruecolor($width, $height);
$image = imagecreatefromjpeg($jpegpath);
imagecopyresampled($image_p, $image, 0, 0, 0, 40, 765, 810, 665, 1000)
imagejpeg($image_p, $destImage, 75);

How do I merely crop x pixels from an image without having black  
bars? I have tried the x coordinate too with the same result.


Thanks,

Chris

On Oct 31, 2007, at 8:58 AM, Merlin wrote:


Merlin schrieb:

Hi everybody,
I am still strugling with the crop problem.
It looks like it is not possible with PHP to do an  
imagecopyresampled

and and imagecopy on the same image.
Here is what I try to do:
1: Resize image to 80px width and correct ratio
2: Crop from that image a 80x60 part
Both work for themselfes, but not together.
Does anybody see the problem?
$outputImg = ImageCreateTrueColor($maxX, $dstY);
imagecopyresampled($outputImg, $inputImg, $posX, $posY,0,0,  
$picX, $picY, $srcX, $srcY);

$outputImg = ImageCreateTrueColor(80, 60);
imagecopy($outputImg, $inputImg, 0,0 , 0, 250, $picX, $picY);
If I leave the second imagecreate away, the image will be copied  
into the bigger size and is not 80x60.

Thank you for any help.
Merlin
David Christopher Zentgraf schrieb:

Copying half a pixel? I dare say that's where the problem is.

Chrs,
Dav

On 31 Oct 2007, at 19:34, Merlin wrote:


Hi there,

I do have a small problem with the proportions of image copy

The image is originally vertical in 100px width and 141px height.
Now I want to crop it to 80 px width and 60px height. There  
should be no black area and the proportions should be OK. That  
means that I have to copy only part of the image. In this case  
it would be 40.5px from above (141-60 / 2 ) and until 100.5  
(40.5+60).

This would crop the middle part of the image.

Now with imagecoyresampled I can set the starting point of  
40.5px, but not the ending point. The image will have a black  
bottom.


Here is the code I am using:
imagecopyresampled($outputImg, $inputImg, 0,0, 0 , 40.5, 80,  
60, $srcX, $srcY);


Thank you for any hint. Maybe somebody has a good idea on how  
to crop that image.


Best regards,

Merlin

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


got it, sorrry for the confusion. I mixed up the lables.

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] crop an image

2007-11-02 Thread Chris Bruce
What was the solution here? I am trying to crop but am getting a  
black bar the same height as the crop at top. For this image I want  
to crop 40 pixels off of the top:


$image_p = imagecreatetruecolor($width, $height);
$image = imagecreatefromjpeg($jpegpath);
imagecopyresampled($image_p, $image, 0, 0, 0, 40, 765, 810, 665, 1000)
imagejpeg($image_p, $destImage, 75);

How do I merely crop x pixels from an image without having black  
bars? I have tried the x coordinate too with the same result.


Thanks,

Chris

On Oct 31, 2007, at 8:58 AM, Merlin wrote:


Merlin schrieb:

Hi everybody,
I am still strugling with the crop problem.
It looks like it is not possible with PHP to do an imagecopyresampled
and and imagecopy on the same image.
Here is what I try to do:
1: Resize image to 80px width and correct ratio
2: Crop from that image a 80x60 part
Both work for themselfes, but not together.
Does anybody see the problem?
$outputImg = ImageCreateTrueColor($maxX, $dstY);
imagecopyresampled($outputImg, $inputImg, $posX, $posY,0,0, $picX,  
$picY, $srcX, $srcY);

$outputImg = ImageCreateTrueColor(80, 60);
imagecopy($outputImg, $inputImg, 0,0 , 0, 250, $picX, $picY);   If  
I leave the second imagecreate away, the image will be copied into  
the bigger size and is not 80x60.

Thank you for any help.
Merlin
David Christopher Zentgraf schrieb:

Copying half a pixel? I dare say that's where the problem is.

Chrs,
Dav

On 31 Oct 2007, at 19:34, Merlin wrote:


Hi there,

I do have a small problem with the proportions of image copy

The image is originally vertical in 100px width and 141px height.
Now I want to crop it to 80 px width and 60px height. There  
should be no black area and the proportions should be OK. That  
means that I have to copy only part of the image. In this case  
it would be 40.5px from above (141-60 / 2 ) and until 100.5 (40.5 
+60).

This would crop the middle part of the image.

Now with imagecoyresampled I can set the starting point of  
40.5px, but not the ending point. The image will have a black  
bottom.


Here is the code I am using:
imagecopyresampled($outputImg, $inputImg, 0,0, 0 , 40.5, 80, 60,  
$srcX, $srcY);


Thank you for any hint. Maybe somebody has a good idea on how to  
crop that image.


Best regards,

Merlin

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


got it, sorrry for the confusion. I mixed up the lables.

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Issues with upgrade to PHP 4.4.1

2006-05-14 Thread Chris Bruce

No one has any thoughts or advice on this?

Chris

On May 12, 2006, at 3:31 PM, Chris Bruce wrote:

I have a dedicated server and my host just did an upgrade of PHP to  
4.4.1. This has caused a couple of major errors and I wanted to  
share them to see if anyone has any answers or has experienced  
similar problems.


1. imap functions are not working correctly. Specifically calling  
it thus:


imap_open({domain.ca:110/pop3},"mailbox","password") gives the  
following error:


Certificate failure for domain.ca: self signed certificate: /C=--/ 
ST=SomeState/L=SomeCity/O=SomeOrganization/ 
OU=SomeOrganizationalUnit/CN=localhost.localdomain/ 
[EMAIL PROTECTED]


if I add "notls" after pop3 "domain.ca:110/pop3/notls", imap_open  
works, but the script fails on the subsequent call to  
imap_fetchstructure.


This was working flawlessly prior to the upgrade to 4.4.1. Here is  
the configure command:
'./configure' '--prefix=/usr/local' '--with-config-file-path=/etc'  
'--with-mysql=/usr/local/mysql' '--enable-ftp' '--enable-bcmath' '-- 
disable-debug' '--with-gd' '--with-jpeg-dir=/usr' '--with-png-dir=/ 
usr/local' '--with-ttf' '--with-freetype-dir=/usr/local/freetype2'  
'--with-zlib' '--with-zlib-dir=/usr' '--with-imap=/usr' '--with- 
imap-ssl' '--with-kerberos' '--with-apache=../apache_1.3.34' '-- 
enable-bcmath' '--with-curl=/usr' '--with-pear' '--enable-ftp' '-- 
enable-calendar' '--enable-memory-limit' '--enable-magic-quotes' '-- 
enable-wddx' '--with-mhash=/ usr/local/mhash' '--with-openssl-dir=/ 
usr/local/ssl' '--with-openssl=/usr/local/ssl' '--enable-mbstring'  
'--with-mcrypt=/usr/local'


My concern here is the "with-imap-ssl". I don't want to use TLS,  
but as above, disabling it causes the script to die.


I have noticed that my host seems to have dropped the build in from  
another server as the build date is from October 2005.


Anyone have any ideas?

2. Using the setcookie() function, I am not able to set an expiry  
for the cookie to anything less than 3603 seconds. 3602 or less  
does not work. Is this a documented bug?


Thanks,

Chris


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Issues with upgrade to PHP 4.4.1

2006-05-12 Thread Chris Bruce
I have a dedicated server and my host just did an upgrade of PHP to  
4.4.1. This has caused a couple of major errors and I wanted to share  
them to see if anyone has any answers or has experienced similar  
problems.


1. imap functions are not working correctly. Specifically calling it  
thus:


imap_open({domain.ca:110/pop3},"mailbox","password") gives the  
following error:


Certificate failure for domain.ca: self signed certificate: /C=--/ 
ST=SomeState/L=SomeCity/O=SomeOrganization/OU=SomeOrganizationalUnit/ 
CN=localhost.localdomain/[EMAIL PROTECTED]


if I add "notls" after pop3 "domain.ca:110/pop3/notls", imap_open  
works, but the script fails on the subsequent call to  
imap_fetchstructure.


This was working flawlessly prior to the upgrade to 4.4.1. Here is  
the configure command:
'./configure' '--prefix=/usr/local' '--with-config-file-path=/etc' '-- 
with-mysql=/usr/local/mysql' '--enable-ftp' '--enable-bcmath' '-- 
disable-debug' '--with-gd' '--with-jpeg-dir=/usr' '--with-png-dir=/ 
usr/local' '--with-ttf' '--with-freetype-dir=/usr/local/freetype2' '-- 
with-zlib' '--with-zlib-dir=/usr' '--with-imap=/usr' '--with-imap- 
ssl' '--with-kerberos' '--with-apache=../apache_1.3.34' '--enable- 
bcmath' '--with-curl=/usr' '--with-pear' '--enable-ftp' '--enable- 
calendar' '--enable-memory-limit' '--enable-magic-quotes' '--enable- 
wddx' '--with-mhash=/ usr/local/mhash' '--with-openssl-dir=/usr/local/ 
ssl' '--with-openssl=/usr/local/ssl' '--enable-mbstring' '--with- 
mcrypt=/usr/local'


My concern here is the "with-imap-ssl". I don't want to use TLS, but  
as above, disabling it causes the script to die.


I have noticed that my host seems to have dropped the build in from  
another server as the build date is from October 2005.


Anyone have any ideas?

2. Using the setcookie() function, I am not able to set an expiry for  
the cookie to anything less than 3603 seconds. 3602 or less does not  
work. Is this a documented bug?


Thanks,

Chris

Re: [PHP] Re: preg_match_all question

2005-07-24 Thread Chris Bruce

It matches any link with the exception of https links.

On Jul 20, 2005, at 3:36 PM, Ethilien wrote:

I don't see anything in this regex that would prevent https from being 
matched, since you don't specify the pattern of the actual url at all.


What is an example of a link that it will match?

Chris Bruce wrote:

Hello,
I am using the following to do link replacing:
preg_match_all("/<\s*a\s+[^>]*href\s*=\s*[\"']?([^\"' >]+)[\"'  
>]/isU",$file[$x],$matches);
It works great for all but 'https' links. I am not that versed in 
regular expressions. Would anyone know what I need to put in there so 
that it will match on https links?

Thanks,
Chris


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] preg_match_all question

2005-07-19 Thread Chris Bruce

Hello,

I am using the following to do link replacing:

preg_match_all("/<\s*a\s+[^>]*href\s*=\s*[\"']?([^\"' >]+)[\"' 
>]/isU",$file[$x],$matches);


It works great for all but 'https' links. I am not that versed in 
regular expressions. Would anyone know what I need to put in there so 
that it will match on https links?


Thanks,

Chris


Re: [PHP] cURL functions

2005-05-13 Thread Chris Bruce
This should work:
 $ch = curl_init(); // create cURL handle (ch)
 if (!$ch) {
die("Couldn't initialize a cURL handle");
 }
 // set some cURL options
 $ret = curl_setopt($ch, CURLOPT_URL,
 "http://images.apple.com/home/2005/images/
 tigershippingdashboard20050429.jpg");
 $ret = curl_setopt($ch, CURLOPT_HEADER, 0);
 $ret = curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
 $ret = curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
 $ret = curl_setopt($ch, CURLOPT_BINARYTRANSFER, 1);
 $ret = curl_setopt($ch, CURLOPT_TIMEOUT, 30);
 // execute
 $ret = curl_exec($ch);
 header("Content-type: image/jpg");
 Header('Content-Disposition: attachment;
 file="tigershippingdashboard20050429.jpg"');
 echo $ret;
Did you try this Jason? When I try it, it just downloads the 
getimage.php file with the binary content of the image in the file.

Chris

Re: [PHP] cURL functions

2005-05-13 Thread Chris Bruce
I did look at your post on PATH_INFO which did not get me any closer to  
the solution. At this point, I am just trying to get an image using  
cURL and then force it to download to the computer. Here is the link:

http://205.207.224.90/getimage.php
and here is the code:
header("Content-type: image/jpg");
Header('Content-Disposition: attachment;  
file="tigershippingdashboard20050429.jpg"');
$ch = curl_init(); // create cURL handle (ch)
if (!$ch) {
  die("Couldn't initialize a cURL handle");
 }
// set some cURL options
$ret = curl_setopt($ch, CURLOPT_URL,  
"http://images.apple.com/home/2005/images/ 
tigershippingdashboard20050429.jpg");
$ret = curl_setopt($ch, CURLOPT_HEADER, 1);
$ret = curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
$ret = curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$ret = curl_setopt($ch, CURLOPT_BINARYTRANSFER, 1);
$ret = curl_setopt($ch, CURLOPT_TIMEOUT, 30);

// execute
$ret = curl_exec($ch);
if (empty($ret)) {
// some kind of an error happened
die(curl_error($ch));
curl_close($ch); // close cURL handler
}
else {
$info = curl_getinfo($ch);
curl_close($ch); // close cURL handler
if (empty($info['http_code'])) {
die("No HTTP code was returned");
}
else {
// load the HTTP codes
// echo results
echo "The server responded: ";
print "";
print_r($info);
print "";
  }
 }
I have tried changing the values of the curl options to no avail. What  
ends up happening is the the PHP file is what gets downloaded with all  
the binary data for the image in it. I need to find a way of getting  
just the image to download.

In this example, I just want the image  
tigershippingdashboard20050429.jpg to download.

Any ideas?
Thanks
Chris
If you want to support older browsers, on more platforms, you would do
well to look at another thread from yesterday where I talk about about
PATH_INFO.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] cURL functions

2005-05-12 Thread Chris Bruce
Hi,
I am connecting to a remote image download API using cURL functions. I 
have the connection working fine and am getting the response from the 
API. The problem is that the resulting image is being displayed as 
binary characters in the browser instead of downloading to my computer. 
Here is the code:

$ch = curl_init(); // create cURL handle (ch)
if (!$ch) {
  die("Couldn't initialize a cURL handle");
 }
// set some cURL options
$ret = curl_setopt($ch, CURLOPT_URL, "path/to/api/with/vars/appended");
$ret = curl_setopt($ch, CURLOPT_HEADER, 0);
$ret = curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
$ret = curl_setopt($ch, CURLOPT_RETURNTRANSFER, 0);
$ret = curl_setopt($ch, CURLOPT_TIMEOUT, 30);
// execute
$ret = curl_exec($ch);
and here are the results from curl_getinfo:
Array
(
[url] => path/to/api/with/vars/appended
[http_code] => 200
[header_size] => 312
[request_size] => 242
[filetime] => -1
[ssl_verify_result] => 0
[total_time] => 0.298
[namelookup_time] => 0.013
[connect_time] => 0.013
[pretransfer_time] => 0.013
[size_upload] => 0
[size_download] => 750690
[speed_download] => 2519093.9597315
[speed_upload] => 0
[download_content_length] => 750690
[upload_content_length] => 0
)
Does anyone know how I can take the binary result and force it to 
download as a JPG image?

Thanks.
Chris


Re: [PHP] parsing values from a form post

2005-04-08 Thread Chris Bruce
Beautiful Chris. That does make things easier. Thanks.
On Apr 8, 2005, at 1:02 PM, Chris Boget wrote:
I can't figure out how to separate these variables and values so that 
I
can do what I need to do.
I've got
foreach($_POST as $var=>$value) {
}
but can't seem to figure out what to do inside.
Ideas??
What you could do is rename the form field names.  Instead of naming
the field 'tax0', you could name it 'tax[0]'.  Once you do that you 
will
find your form infinitely easier to work with doing what you want to 
do.

thnx,
Chris
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

--
Chris Bruce
[EMAIL PROTECTED]
Idextrus E-Business Architects
http://www.idextrus.com
3282 Wilmar Cres.
Mississauga, ON
L5L4B2
CA
905.828.9189 South Office
705.361.0331 North Office
Skype: callto://chrisrjbruce

This e-mail and its contents are privileged, confidential and
subject to copyright.  If you are not the intended recipient,
please delete this e-mail immediately.  Any unauthorized use
or disclosure of the information herein is prohibited.


[PHP] parsing values from a form post

2005-04-08 Thread Chris Bruce
Hello,
Here is an example of what could be posted from a form:
Array
(
[tax0] => GST
[amount0] => 10.23
[type0] => Goods
[tax1] => GST
[amount1] => 6.5
[type1] => Goods
[tax2] => HST
[amount2] => 3.54
[type2] => Goods
[tax3] => HST
[amount3] => 8.95
[type3] => Hotel
[tax4] => GST
[amount4] => 44.5
[type4] => Goods
)
I need to be able to break out the tax, amount and type that were 
entered on each line of a form and then apply calculations and do 
database inserts on each. As you can see what I need is in sets of 
three denoted by the integer at the end (tax0, amount0, type0, tax1 
etc.)

I can't figure out how to separate these variables and values so that I 
can do what I need to do.

I've got
foreach($_POST as $var=>$value) {
}
but can't seem to figure out what to do inside.
Ideas??
Thanks Chris

Re: [PHP] Download system

2005-03-21 Thread Chris Bruce
How about setting up symbolic links on the server in a tmp directory. 
You could use the values from your database table to create the sym 
links. Have the sym link be the token name and then have it linked to 
the real file name. You could then have a cron job running to clear the 
sym links at set intervals. I do this for a Royalty Free stock site and 
it works great.

Chris
On Mar 21, 2005, at 7:08 PM, JoShQuNe ((TR)) wrote:
--- Richard Lynch <[EMAIL PROTECTED]> wrote:
On Mon, March 21, 2005 3:45 pm, JoShQuNe \(TR\) said:
Hi, i want to add my site a more specific download system. The 
redirecting
is now done by directly
giving the path of the file to variable. I want to do it over an id
number.
(now: dl.php?rel=/files/somefile.zip, i want: dl.php?id=64b3j283) 
The file
path and id is read
from mysql table. System is now; it matches from table and lets 
visitor to
download but putting
this kind of path is something useless. Download script is just used 
for
counting the hit but for
example i want to rename the file while giving to visitor instead of
letting user to learn where
it is stored and its real name, 
The_Justice_by_Someone_MyDomain_com.zip
looks like what i want to
have. I tried this system with header("Location: .."); but it 
just
opened a new page and
nothing happened else. For example if visitor uses FlashGet i want 
him to
see just an address
which doesnt involve the real path and name. If any body can help me,
please.. Thanx a lot..

--
Chris Bruce
[EMAIL PROTECTED]
Idextrus E-Business Architects
http://www.idextrus.com
3282 Wilmar Cres.
Mississauga, ON
L5L4B2
CA
905.828.9189 South Office
705.361.0331 North Office
Skype: callto://chrisrjbruce

This e-mail and its contents are privileged, confidential and
subject to copyright.  If you are not the intended recipient,
please delete this e-mail immediately.  Any unauthorized use
or disclosure of the information herein is prohibited.


[PHP] Re: Handling email bouncebacks

2005-02-16 Thread Chris Bruce
Jamie,
Thanks for your detailed response and suggestions. Here is where I am 
at currently:

I have set up a [EMAIL PROTECTED] address and POP3 account on my server to 
handle all bounces. When my system sends out the email campaign and 
loops through the addresses, I encode the recipient address and then at 
it to the return path like so: Return-Path: encodedaddress 
<[EMAIL PROTECTED]>

Then I have a function using the IMAP functions in PHP that opens the 
mailbox and reads the following information:
imap_header, imap_body

The header has the To: address containing the actual pop account 
address prepended by the encoded recipient address. I decode the 
address, and now I have the intended recipient.

The body has the complete body of the email. From my research I 
know(think) that I am looking for a "Status: x.x.x" value in the body. 
I explode the body into an array and then use an in_array condition to 
look for status codes.

So far I am successful at getting the intended recipient address and 
the status code. Now I have to do something with that info :)

Thanks again for your time.
Chris
On Feb 16, 2005, at 1:31 PM, Jamie Alessio wrote:
I am looking for a way to manage email bouncebacks on my Linux server 
for one of my client's email marketing system. What I would like to 
do is have a way of capturing the email address from the header of 
each bounce and insert it into a MySQL table. At that point I can do 
the requisite scrubbing of the lists. I believe that I saw a PHP 
class a while back that handled this. Does anyone have any experience 
with this?
Chris,
I find that the tricky part of this sort of thing is actually 
accessing the bounce messages. I prefer to process the messages as 
they arrive at the mail server which means getting your MTA to hand 
off the entire message to your script for processing. My solution is 
to use qmail (www.qmail.org) as my MTA and have qmail pipe the 
messages that are delivered to certain address to my script. At that 
point you can then parse through the message and take appropriate 
action. Other MTAs like sendmail can do this too, but what qmail 
offers is the ability to easily handle incoming addresses that look 
like this:

[EMAIL PROTECTED]
So, you direct [EMAIL PROTECTED] to a script (a command line PHP 
script in this case) and you can easily ascertain that your message 
with the ID=28 to "[EMAIL PROTECTED]" bounced. You would presumably have 
some record of sending a message to [EMAIL PROTECTED] with an ID of 28 
so you could then mark that email as 'bounced' in your database. Then 
you could remove [EMAIL PROTECTED] from the list when you have record of 
the address bounces something like three consecutive times. To get 
bounce messages in the above format you need to add a header like this 
to your outgoing email:

Return-Path: <[EMAIL PROTECTED]>
This is all very qmail-ish and is completely ripped off from ezmlm 
(www.ezmlm.org) which is a qmail-based mailing list manager written by 
the author of qmail. If you need to do bounce handling on a large 
scale with a lot of different lists I suggest researching how ezmlm 
handles it.

Another poster, Ligaya, mentioned what is probably a simpler solution 
if you need to do this on a small scale. Get your MTA to deliver the 
bounce messages to a single mailbox and then use PHP's IMAP functions 
to get the mail and parse it or you may even be able to access the 
mbox file directly using PEAR's Mail_Mbox class 
(http://pear.php.net/package/Mail_Mbox).

Hope that helps - just wanted to throw out the more complex scenario 
as you might not have initially thought of an approach like that.

- Jamie

--
Chris Bruce
[EMAIL PROTECTED]
Idextrus E-Business Architects
http://www.idextrus.com
3282 Wilmar Cres.
Mississauga, ON
L5L4B2
CA
905.828.9189 South Office
705.361.0331 North Office

This e-mail and its contents are privileged, confidential and
subject to copyright.  If you are not the intended recipient,
please delete this e-mail immediately.  Any unauthorized use
or disclosure of the information herein is prohibited.


[PHP] Handling email bouncebacks

2005-02-15 Thread Chris Bruce
Hi,
I am looking for a way to manage email bouncebacks on my Linux server 
for one of my client's email marketing system. What I would like to do 
is have a way of capturing the email address from the header of each 
bounce and insert it into a MySQL table. At that point I can do the 
requisite scrubbing of the lists. I believe that I saw a PHP class a 
while back that handled this. Does anyone have any experience with 
this?

Thanks
Chris
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Writing static file from dynamic PHP page

2005-01-18 Thread Chris Bruce
This is a great solution, except I cannot get PHP to exec the file that 
has the 'wget' command in it.

What I have done is to create a file (wget.php) into the directory that 
I want to wget the page into. I then chmod -R the directory to make 
everything in it executable.
here is what is written to the file:
/usr/bin/wget -d http://path/to/file/index.html

Then in the PHP function I make a an exec call on that file
exec(/path/to/file/wget.php,$out,$err);
Everything is cool, except the exec does not happen. The $out array 
looks like this:
Array
{
}
and the $err returns '126'

But the exec doesn't happen. If I run the contents of wget.php on the 
command line, presto, it works.

So, what is the deal? Is it a problem with the apache user not having 
access to wget through PHP??

On Jan 18, 2005, at 11:41 AM, Richard Lynch wrote:


Chris Bruce wrote:
sorry for the repost, but my mail server was down from about 11pmEST
last night to 9:15am this morning and unable to receive responses. Can
someone forward me responses to this post if any? Thanks. Chris
Hi,
I am looking for a way to write to a file what the browser would see
(raw html) when viewing a dynamic PHP page. I have numerous include
files, MySQL db queries, loops etc. and I want to generate the 
static
result of that file and save it as an html page. I have toyed a 
little
with output buffering to no avail.

Is there an easy way to do this?
Just build the site you want with PHP, and then use wget to suck down 
the
pages into your static directory.

Output buffering should have worked, but it's too easy for somebody 
else
to mess up the buffering if they want to use it for something else in
their business logic.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Writing static file from dynamic PHP page

2005-01-18 Thread Chris Bruce
sorry for the repost, but my mail server was down from about 11pmEST 
last night to 9:15am this morning and unable to receive responses. Can 
someone forward me responses to this post if any? Thanks. Chris

Hi,
I am looking for a way to write to a file what the browser would see
(raw html) when viewing a dynamic PHP page. I have numerous include
files, MySQL db queries, loops etc. and I want to generate the static
result of that file and save it as an html page. I have toyed a little
with output buffering to no avail.
Is there an easy way to do this?
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Writing static file from dynamic PHP page

2005-01-17 Thread Chris Bruce
Hi,
I am looking for a way to write to a file what the browser would see 
(raw html) when viewing a dynamic PHP page. I have numerous include 
files, MySQL db queries, loops etc. and I want to generate the static 
result of that file and save it as an html page. I have toyed a little 
with output buffering to no avail.

Is there an easy way to do this?
Thanks,
Chris
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Question on using png file in ezPdf class

2004-09-21 Thread Chris Bruce
Don't think that is it, but for the record, it is compiled with-png. 
Thanks for the stab though :)

--
Chris Bruce
[EMAIL PROTECTED]
Idextrus E-Business Architects
http://www.idextrus.com
3282 Wilmar Cres.
Mississauga, ON
L5L4B2
CA
905.828.9189 South Office
705.361.0331 North Office

This e-mail and its contents are privileged, confidential and
subject to copyright.  If you are not the intended recipient,
please delete this e-mail immediately.  Any unauthorized use
or disclosure of the information herein is prohibited.
On Sep 21, 2004, at 12:32 PM, Jason Davidson wrote:
Possibly you need to compile php with-png ??  im not sure of this, im
just taking a stab in the dark..
Jason
Chris Bruce <[EMAIL PROTECTED]> wrote:
Hello,
I am using the PDF creation classes from http://www.ros.co.nz/pdf
Everything is working great with the exception of not being able to 
use
a PNG image with the ezImage extension. JPG works but is not as crisp
as the image that I want to place is a logo. All file paths and
spellings are correct, the resulting PDF just has a whitespace where
the logo should be when I try to use a PNG.

Has anyone who has used this class encountered a similar problem?
Thanks.
--
Chris Bruce
[EMAIL PROTECTED]
Idextrus E-Business Architects
http://www.idextrus.com
3282 Wilmar Cres.
Mississauga, ON
L5L4B2
CA
905.828.9189 South Office
705.361.0331 North Office

This e-mail and its contents are privileged, confidential and
subject to copyright.  If you are not the intended recipient,
please delete this e-mail immediately.  Any unauthorized use
or disclosure of the information herein is prohibited.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Question on using png file in ezPdf class

2004-09-21 Thread Chris Bruce
Hello,
I am using the PDF creation classes from http://www.ros.co.nz/pdf
Everything is working great with the exception of not being able to use 
a PNG image with the ezImage extension. JPG works but is not as crisp 
as the image that I want to place is a logo. All file paths and 
spellings are correct, the resulting PDF just has a whitespace where 
the logo should be when I try to use a PNG.

Has anyone who has used this class encountered a similar problem?
Thanks.
--
Chris Bruce
[EMAIL PROTECTED]
Idextrus E-Business Architects
http://www.idextrus.com
3282 Wilmar Cres.
Mississauga, ON
L5L4B2
CA
905.828.9189 South Office
705.361.0331 North Office

This e-mail and its contents are privileged, confidential and
subject to copyright.  If you are not the intended recipient,
please delete this e-mail immediately.  Any unauthorized use
or disclosure of the information herein is prohibited.


Re: [PHP] http referrer

2004-04-08 Thread Chris Bruce
Damn! It can't be that easy ;) But, yes, it works. Thanks a bunch.

--

Chris Bruce
[EMAIL PROTECTED]
Idextrus
E-Business Architects
http://www.idextrus.com
3282 Wilmar Cres.
Mississauga, ON
L5L4B2
CA
905.828.9189

This e-mail and its contents are privileged, confidential and
subject to copyright.  If you are not the intended recipient,
please delete this e-mail immediately.  Any unauthorized use
or disclosure of the information herein is prohibited.
On Apr 8, 2004, at 12:25 PM, Robert Cummings wrote:

On Thu, 2004-04-08 at 12:22, Chris Bruce wrote:
I apologize for my ignorance, but I am trying to find a way to grab 
the
referring url. I can't seem to find the environment variable to do
this. Does anyone know how to grab this?

HTTP_REFERER. Someone spelled it wrong a long time ago and it stuck :)

Cheers,
Rob.
--
..
| InterJinn Application Framework - http://www.interjinn.com |
::
| An application and templating framework for PHP. Boasting  |
| a powerful, scalable system for accessing system services  |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for   |
| creating re-usable components quickly and easily.  |
`'


[PHP] http referrer

2004-04-08 Thread Chris Bruce
I apologize for my ignorance, but I am trying to find a way to grab the 
referring url. I can't seem to find the environment variable to do 
this. Does anyone know how to grab this?

Thanks.

--

Chris Bruce
[EMAIL PROTECTED]
Idextrus
E-Business Architects
http://www.idextrus.com
3282 Wilmar Cres.
Mississauga, ON
L5L4B2
CA
905.828.9189

This e-mail and its contents are privileged, confidential and
subject to copyright.  If you are not the intended recipient,
please delete this e-mail immediately.  Any unauthorized use
or disclosure of the information herein is prohibited.


[PHP] Function to check a valid date

2004-03-20 Thread Chris Bruce
Hello all,

I was going to build a function to check whether a selected date 
exists, but thought that I would see if anyone has done this type of 
thing already which would indeed save me some time.

I have a form where the users select the day of the week, month, date 
and year from 4 pulldowns. (Saturday, March 20, 2004). I need to have a 
function that will check to see if that is indeed a real date.

Does this sound familiar to anyone?

Thanks a bunch :)

--

Chris Bruce
[EMAIL PROTECTED]
Idextrus
E-Business Architects
http://www.idextrus.com
3282 Wilmar Cres.
Mississauga, ON
L5L4B2
CA
905.828.9189

This e-mail and its contents are privileged, confidential and
subject to copyright.  If you are not the intended recipient,
please delete this e-mail immediately.  Any unauthorized use
or disclosure of the information herein is prohibited.


Re: [PHP] Help with '&' character

2004-02-17 Thread Chris Bruce
You are right John. I have it working now. Thanks.

--

Chris Bruce
[EMAIL PROTECTED]
Idextrus
E-Business Architects
http://www.idextrus.com
3282 Wilmar Cres.
Mississauga, ON
L5L4B2
CA
905.828.9189

This e-mail and its contents are privileged, confidential and
subject to copyright.  If you are not the intended recipient,
please delete this e-mail immediately.  Any unauthorized use
or disclosure of the information herein is prohibited.
On Feb 17, 2004, at 12:48 PM, John W. Holmes wrote:

From: "Chris Bruce" <[EMAIL PROTECTED]>

I am having trouble with a string becoming truncated at an '&'
character. I am passing the variable via a link
(http://...&campaign=MBI%20List%20-%20Steel%20&%20Concrete) and then
when I try to grab the incoming value of campaign into a SELECT query,
it becomes
SELECT sum(sends) from campaigns where name='MBI List - Steel '

I have tried to urlencode the variable, and also use htmlentities, 
etc.
to no avail.
Show how you tried to use urlencode() and put the value in the URL, 
because
that's the correct solution.

---John Holmes...

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Help with '&' character

2004-02-17 Thread Chris Bruce
The problem is that the '&' character is already in a database. I am 
trying to do a query where I need to have it as '&', but like I said, 
when it comes into the script from the url it gets truncated.

--

Chris Bruce
[EMAIL PROTECTED]
Idextrus
E-Business Architects
http://www.idextrus.com
3282 Wilmar Cres.
Mississauga, ON
L5L4B2
CA
905.828.9189

This e-mail and its contents are privileged, confidential and
subject to copyright.  If you are not the intended recipient,
please delete this e-mail immediately.  Any unauthorized use
or disclosure of the information herein is prohibited.
On Feb 17, 2004, at 12:40 PM, Miguel J. Jiménez wrote:

Have you tried using '&' ?

Chris Bruce wrote:

I am having trouble with a string becoming truncated at an '&' 
character. I am passing the variable via a link

(http://...&campaign=MBI%20List%20-%20Steel%20&%20Concrete) and then 
when I try to grab the incoming value of campaign into a SELECT 
query, it becomes

SELECT sum(sends) from campaigns where name='MBI List - Steel '

I have tried to urlencode the variable, and also use htmlentities, 
etc. to no avail.

Does anyone have a solution for this?

Thanks.


[PHP] Help with '&' character

2004-02-17 Thread Chris Bruce
I am having trouble with a string becoming truncated at an '&' 
character. I am passing the variable via a link

(http://...&campaign=MBI%20List%20-%20Steel%20&%20Concrete) and then 
when I try to grab the incoming value of campaign into a SELECT query, 
it becomes

SELECT sum(sends) from campaigns where name='MBI List - Steel '

I have tried to urlencode the variable, and also use htmlentities, etc. 
to no avail.

Does anyone have a solution for this?

Thanks.

--

Chris Bruce
[EMAIL PROTECTED]
Idextrus
E-Business Architects
http://www.idextrus.com
3282 Wilmar Cres.
Mississauga, ON
L5L4B2
CA
905.828.9189

This e-mail and its contents are privileged, confidential and
subject to copyright.  If you are not the intended recipient,
please delete this e-mail immediately.  Any unauthorized use
or disclosure of the information herein is prohibited.


Re: [PHP] Comparing multiple Mysql tables to find duplicates

2004-02-03 Thread Chris Bruce
HI John,

I have this working with the exception of when there is a ' in an email 
address that I want to remove.

I have modified your line { $email_list .= "'{$row['email']}',"; }, 
with { $email_list .= str_replace("'", "\'", "'{$r[email]}',"); }, but 
now it escapes all the single quotes. Is there a php function that 
escapes single quotes in Mysql queries? If not, do you know the best 
way to escape *only* single quotes in the email address string and not 
the single quotes surrounding the string?

Example (output of $email_list) 
'[EMAIL PROTECTED]','[EMAIL PROTECTED]'that.com','etc...
Need to escape the [EMAIL PROTECTED]'that.com

Thanks.

--

Chris Bruce
[EMAIL PROTECTED]
Idextrus
E-Business Architects
http://www.idextrus.com
3282 Wilmar Cres.
Mississauga, ON
L5L4B2
CA
905.828.9189

This e-mail and its contents are privileged, confidential and
subject to copyright.  If you are not the intended recipient,
please delete this e-mail immediately.  Any unauthorized use
or disclosure of the information herein is prohibited.
On Jan 30, 2004, at 12:54 PM, John W. Holmes wrote:

From: "Chris Bruce" <[EMAIL PROTECTED]>

Mysql 3.23.54.

My first thought was to load the output from the tables into an array
and they use a foreach and in_array to create a list of dups, but I
wanted to see if there was an easier way.
Ah, in that case, my other query won't work. :)

This should:


$query = "SELECT list1.email FROM master_list, list1 WHERE 
master_list.email
= list1.email";
$result = mysql_query($query) or die(mysql_error());
while($r = mysql_fetch_assoc($result))
{ $email_list .= "'{$row['email']}',"; }
$email_list = substr($email_list,0,-1); //remove last comma

$query = "DELETE FROM list1 WHERE email IN ($email_list)";
$result = mysql_query($query) or die(mysql_error());
?>
Repeat for other tables.

---John Holmes...

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Comparing multiple Mysql tables to find duplicates

2004-01-30 Thread Chris Bruce
Cool, thanks John, I'll give it a shot. Sorry for the last email, I 
sent it before you sent this one :)

--

Chris Bruce
[EMAIL PROTECTED]
Idextrus
E-Business Architects
http://www.idextrus.com
3282 Wilmar Cres.
Mississauga, ON
L5L4B2
CA
905.828.9189
On Jan 30, 2004, at 12:54 PM, John W. Holmes wrote:
From: "Chris Bruce" <[EMAIL PROTECTED]>

Mysql 3.23.54.

My first thought was to load the output from the tables into an array
and they use a foreach and in_array to create a list of dups, but I
wanted to see if there was an easier way.
Ah, in that case, my other query won't work. :)

This should:


$query = "SELECT list1.email FROM master_list, list1 WHERE 
master_list.email
= list1.email";
$result = mysql_query($query) or die(mysql_error());
while($r = mysql_fetch_assoc($result))
{ $email_list .= "'{$row['email']}',"; }
$email_list = substr($email_list,0,-1); //remove last comma

$query = "DELETE FROM list1 WHERE email IN ($email_list)";
$result = mysql_query($query) or die(mysql_error());
?>
Repeat for other tables.

---John Holmes...

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Comparing multiple Mysql tables to find duplicates

2004-01-30 Thread Chris Bruce
This will work for Mysql 3.23.54?

--

Chris Bruce
[EMAIL PROTECTED]
Idextrus
E-Business Architects
http://www.idextrus.com
3282 Wilmar Cres.
Mississauga, ON
L5L4B2
CA
905.828.9189
On Jan 30, 2004, at 12:48 PM, John W. Holmes wrote:
From: "Chris Bruce" <[EMAIL PROTECTED]>

I am trying to write a function that would compare one table to a
number of other tables in Mysql and remove any duplicates found. This
is for tables of email addresses where I want to remove any dups 
found.

Example:
Master list - compare to list1, list2, list3, and so on and remove
matches found from list1, list2, list3 etc. *not* from Master list.
Does anyone know of any such beast before I set out to reinvent it?
DELETE FROM list1 USING master_list, list1 WHERE list1.email =
master_list.email
Repeat for other tables.

---John Holmes...



Re: [PHP] Comparing multiple Mysql tables to find duplicates

2004-01-30 Thread Chris Bruce
Mysql 3.23.54.

My first thought was to load the output from the tables into an array  
and they use a foreach and in_array to create a list of dups, but I  
wanted to see if there was an easier way.

--

Chris Bruce
[EMAIL PROTECTED]
Idextrus
E-Business Architects
http://www.idextrus.com
3282 Wilmar Cres.
Mississauga, ON
L5L4B2
CA
905.828.9189
On Jan 30, 2004, at 12:54 PM, Raditha Dissanayake wrote:
Hi,

If you are using mysql 4 you can use subselects  to delete from where  
in (select) the select itself can be a multi table join. if you are on  
mysql 3.xx you can use PHP to mimic a subselect.



Chris Bruce wrote:

Hello everyone,

I am trying to write a function that would compare one table to a  
number of other tables in Mysql and remove any duplicates found. This  
is for tables of email addresses where I want to remove any dups  
found.

Example:
Master list - compare to list1, list2, list3, and so on and remove  
matches found from list1, list2, list3 etc. *not* from Master list.

Does anyone know of any such beast before I set out to reinvent it?

Thanks.

Chris



--  
Raditha Dissanayake.
--- 
-
http://www.radinks.com/sftp/ |  
http://www.raditha.com/megaupload
Lean and mean Secure FTP applet with | Mega Upload - PHP file uploader
Graphical User Inteface. Just 150 KB | with progress bar.



[PHP] Comparing multiple Mysql tables to find duplicates

2004-01-30 Thread Chris Bruce
Hello everyone,

I am trying to write a function that would compare one table to a 
number of other tables in Mysql and remove any duplicates found. This 
is for tables of email addresses where I want to remove any dups found.

Example:
Master list - compare to list1, list2, list3, and so on and remove 
matches found from list1, list2, list3 etc. *not* from Master list.

Does anyone know of any such beast before I set out to reinvent it?

Thanks.

Chris

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Calling mail() in a loop

2003-11-13 Thread Chris Bruce
Hello all, this is my first post and I have found this list very 
resourceful for me so far.

Here is my question:

I have built a small system to allow my clients to send out permission 
emails to their customers from a MySQL db. It is testing fine to a 
small number of email addresses, but I want to know how it will run if 
the loop gets upwards of 1000+. I could add my email address to the 
database 1000 times, but I don't want to receive this many emails (for 
obvious reasons). Does anyone know first of all how mail() will respond 
being called this many times, and secondly any other function that I 
could call that would be a similar test without having to send out 
emails.

Thanks for your time.

Cheers,

Chris

--

Chris Bruce
[EMAIL PROTECTED]
Idextrus
http://www.idextrus.com
3282 Wilmar Cres.
Mississauga, ON
L5L4B2
CA
905.828.9189