php-general Digest 13 May 2009 08:11:48 -0000 Issue 6118

Topics (messages 292506 through 292519):

Re: Watermarking of images
        292506 by: Robert Cummings
        292508 by: tedd
        292509 by: Robert Cummings
        292510 by: PJ
        292513 by: Robert Cummings
        292515 by: PJ

Re: Mail subject encoding breaks
        292507 by: Tom Worster

handling chunked input from php://stdin
        292511 by: whisperstream
        292516 by: Shawn McKenzie

database session management with mdb2
        292512 by: Michael A. Peters
        292514 by: Michael A. Peters

Urgent problem PCRE or DOM help
        292517 by: Lenin

fileinfo on RHEL5
        292518 by: brian

[PHP ADVANCE] tcp CLIENT server connection and authentication
        292519 by: Andrew Williams

Administrivia:

To subscribe to the digest, e-mail:
        php-general-digest-subscr...@lists.php.net

To unsubscribe from the digest, e-mail:
        php-general-digest-unsubscr...@lists.php.net

To post to the list, e-mail:
        php-gene...@lists.php.net


----------------------------------------------------------------------
--- Begin Message ---
On Tue, 2009-05-12 at 09:54 -0400, tedd wrote:
> At 12:27 PM -0700 5/11/09, Daevid Vincent wrote:
> >  > > Here's an example with code:
> >>  >
> >  > > http://webbytedd.com/b/watermark/
> >>
> >>  I can't read the text over the dog's nose... ;)
> >
> >You're lucky. I don't see ANYTHING (as mentioned weeks ago already)...
> >
> >XP. FF 3.0.10 and IE 6.
> >
> >BOTH do not work.
> >
> >FF console says "startup is not defined" and "unknown property 'zoom'.
> >declaration dropped."
> 
> Daevid:
> 
> Interesting, try again:
> 
> http://webbytedd.com/b/watermark/
> 
> It works for me in IE6 and IE7 as well as FF on both XP and Vista.
> 
> All I did was to remove the references to empty js and css files.

I think you missed the point of my comment about the black text over the
dog's black nose. The whole thrust of this thread was to determine how
to get the black outline around the text. The OP already had text on an
image and I showed how to get an outline so that regardless of the image
content the watermark would always be readable.

Cheers,
Rob.
-- 
http://www.interjinn.com
Application and Templating Framework for PHP


--- End Message ---
--- Begin Message ---
At 3:48 PM -0400 5/12/09, Robert Cummings wrote:
On Tue, 2009-05-12 at 09:54 -0400, tedd wrote:
 At 12:27 PM -0700 5/11/09, Daevid Vincent wrote:
 >  > > Here's an example with code:
 >>  >
 >  > > http://webbytedd.com/b/watermark/
 >>
 >>  I can't read the text over the dog's nose... ;)
 >
 >You're lucky. I don't see ANYTHING (as mentioned weeks ago already)...
 >
 >XP. FF 3.0.10 and IE 6.
 >
 >BOTH do not work.
 >
 >FF console says "startup is not defined" and "unknown property 'zoom'.
 >declaration dropped."

 Daevid:

 Interesting, try again:

 http://webbytedd.com/b/watermark/

 It works for me in IE6 and IE7 as well as FF on both XP and Vista.

 All I did was to remove the references to empty js and css files.

I think you missed the point of my comment about the black text over the
dog's black nose. The whole thrust of this thread was to determine how
to get the black outline around the text. The OP already had text on an
image and I showed how to get an outline so that regardless of the image
content the watermark would always be readable.

Cheers,
Rob.

Rob:

I didn't miss it, I just didn't address that part of the post. Please note -- the OP originally asked:

[1] --- quote
That site is also coded in php so I'm guessing that the watermark is added using a php technology.

Can someone enlighten me on how that is done?
-- unquote

And:

[2] --- quote
Also, while not php related, could someone enlighten me of a really good font to use for watermarking images?
-- unquote

While your post dealt with [2] mine was addressing [1]. Understand?

Cheers,

tedd

--
-------
http://sperling.com  http://ancientstones.com  http://earthstones.com

--- End Message ---
--- Begin Message ---
On Tue, 2009-05-12 at 16:31 -0400, tedd wrote:
> At 3:48 PM -0400 5/12/09, Robert Cummings wrote:
> >On Tue, 2009-05-12 at 09:54 -0400, tedd wrote:
> >>  At 12:27 PM -0700 5/11/09, Daevid Vincent wrote:
> >>  >  > > Here's an example with code:
> >>  >>  >
> >>  >  > > http://webbytedd.com/b/watermark/
> >>  >>
> >>  >>  I can't read the text over the dog's nose... ;)
> >>  >
> >>  >You're lucky. I don't see ANYTHING (as mentioned weeks ago already)...
> >>  >
> >>  >XP. FF 3.0.10 and IE 6.
> >>  >
> >>  >BOTH do not work.
> >>  >
> >>  >FF console says "startup is not defined" and "unknown property 'zoom'.
> >>  >declaration dropped."
> >>
> >>  Daevid:
> >>
> >>  Interesting, try again:
> >>
> >>  http://webbytedd.com/b/watermark/
> >>
> >>  It works for me in IE6 and IE7 as well as FF on both XP and Vista.
> >>
> >>  All I did was to remove the references to empty js and css files.
> >
> >I think you missed the point of my comment about the black text over the
> >dog's black nose. The whole thrust of this thread was to determine how
> >to get the black outline around the text. The OP already had text on an
> >image and I showed how to get an outline so that regardless of the image
> >content the watermark would always be readable.
> >
> >Cheers,
> >Rob.
> 
> Rob:
> 
> I didn't miss it, I just didn't address that part of the post. Please 
> note -- the OP originally asked:
> 
> [1] --- quote
> >That site is also coded in php so I'm guessing that the watermark is 
> >added using a php technology.
> >
> >Can someone enlighten me on how that is done?
> -- unquote
> 
> And:
> 
> [2] --- quote
> >Also, while not php related, could someone enlighten me of a really 
> >good font to use for watermarking images?
> -- unquote
> 
> While your post dealt with [2] mine was addressing [1]. Understand?

Except he already had that part working. He wanted to get the outline.
You would know that if you read the full post since he gave a link to
what he already had using PHP. When he says:

     "That site is also coded in php so I'm guessing that the
      watermark is added using a php technology."

It means that he can presumably also generate a watermark with an
outline using PHP and GD.

Comprendez vous?

Cheers,
Rob.
-- 
http://www.interjinn.com
Application and Templating Framework for PHP


--- End Message ---
--- Begin Message ---
Robert Cummings wrote:
> On Tue, 2009-05-12 at 16:31 -0400, tedd wrote:
>   
>> At 3:48 PM -0400 5/12/09, Robert Cummings wrote:
>>     
>>> On Tue, 2009-05-12 at 09:54 -0400, tedd wrote:
>>>       
>>>>  At 12:27 PM -0700 5/11/09, Daevid Vincent wrote:
>>>>  >  > > Here's an example with code:
>>>>  >>  >
>>>>  >  > > http://webbytedd.com/b/watermark/
>>>>  >>
>>>>  >>  I can't read the text over the dog's nose... ;)
>>>>  >
>>>>  >You're lucky. I don't see ANYTHING (as mentioned weeks ago already)...
>>>>  >
>>>>  >XP. FF 3.0.10 and IE 6.
>>>>  >
>>>>  >BOTH do not work.
>>>>  >
>>>>  >FF console says "startup is not defined" and "unknown property 'zoom'.
>>>>  >declaration dropped."
>>>>
>>>>  Daevid:
>>>>
>>>>  Interesting, try again:
>>>>
>>>>  http://webbytedd.com/b/watermark/
>>>>
>>>>  It works for me in IE6 and IE7 as well as FF on both XP and Vista.
>>>>
>>>>  All I did was to remove the references to empty js and css files.
>>>>         
>>> I think you missed the point of my comment about the black text over the
>>> dog's black nose. The whole thrust of this thread was to determine how
>>> to get the black outline around the text. The OP already had text on an
>>> image and I showed how to get an outline so that regardless of the image
>>> content the watermark would always be readable.
>>>
>>> Cheers,
>>> Rob.
>>>       
>> Rob:
>>
>> I didn't miss it, I just didn't address that part of the post. Please 
>> note -- the OP originally asked:
>>
>> [1] --- quote
>>     
>>> That site is also coded in php so I'm guessing that the watermark is 
>>> added using a php technology.
>>>
>>> Can someone enlighten me on how that is done?
>>>       
>> -- unquote
>>
>> And:
>>
>> [2] --- quote
>>     
>>> Also, while not php related, could someone enlighten me of a really 
>>> good font to use for watermarking images?
>>>       
>> -- unquote
>>
>> While your post dealt with [2] mine was addressing [1]. Understand?
>>     
>
> Except he already had that part working. He wanted to get the outline.
> You would know that if you read the full post since he gave a link to
> what he already had using PHP. When he says:
>
>      "That site is also coded in php so I'm guessing that the
>       watermark is added using a php technology."
>
> It means that he can presumably also generate a watermark with an
> outline using PHP and GD.
>
> Comprendez vous?
>   
That's "comprenez-vous?" Comprends-tu? ;-)
> Cheers,
> Rob.
>   


-- 
Hervé Kempf: "Pour sauver la planète, sortez du capitalisme."
-------------------------------------------------------------
Phil Jourdan --- p...@ptahhotep.com
   http://www.ptahhotep.com
   http://www.chiccantine.com/andypantry.php


--- End Message ---
--- Begin Message ---
On Tue, 2009-05-12 at 18:53 -0400, PJ wrote:
> Robert Cummings wrote:
> > On Tue, 2009-05-12 at 16:31 -0400, tedd wrote:
> >   
> >> At 3:48 PM -0400 5/12/09, Robert Cummings wrote:
> >>     
> >>> On Tue, 2009-05-12 at 09:54 -0400, tedd wrote:
> >>>       
> >>>>  At 12:27 PM -0700 5/11/09, Daevid Vincent wrote:
> >>>>  >  > > Here's an example with code:
> >>>>  >>  >
> >>>>  >  > > http://webbytedd.com/b/watermark/
> >>>>  >>
> >>>>  >>  I can't read the text over the dog's nose... ;)
> >>>>  >
> >>>>  >You're lucky. I don't see ANYTHING (as mentioned weeks ago already)...
> >>>>  >
> >>>>  >XP. FF 3.0.10 and IE 6.
> >>>>  >
> >>>>  >BOTH do not work.
> >>>>  >
> >>>>  >FF console says "startup is not defined" and "unknown property 'zoom'.
> >>>>  >declaration dropped."
> >>>>
> >>>>  Daevid:
> >>>>
> >>>>  Interesting, try again:
> >>>>
> >>>>  http://webbytedd.com/b/watermark/
> >>>>
> >>>>  It works for me in IE6 and IE7 as well as FF on both XP and Vista.
> >>>>
> >>>>  All I did was to remove the references to empty js and css files.
> >>>>         
> >>> I think you missed the point of my comment about the black text over the
> >>> dog's black nose. The whole thrust of this thread was to determine how
> >>> to get the black outline around the text. The OP already had text on an
> >>> image and I showed how to get an outline so that regardless of the image
> >>> content the watermark would always be readable.
> >>>
> >>> Cheers,
> >>> Rob.
> >>>       
> >> Rob:
> >>
> >> I didn't miss it, I just didn't address that part of the post. Please 
> >> note -- the OP originally asked:
> >>
> >> [1] --- quote
> >>     
> >>> That site is also coded in php so I'm guessing that the watermark is 
> >>> added using a php technology.
> >>>
> >>> Can someone enlighten me on how that is done?
> >>>       
> >> -- unquote
> >>
> >> And:
> >>
> >> [2] --- quote
> >>     
> >>> Also, while not php related, could someone enlighten me of a really 
> >>> good font to use for watermarking images?
> >>>       
> >> -- unquote
> >>
> >> While your post dealt with [2] mine was addressing [1]. Understand?
> >>     
> >
> > Except he already had that part working. He wanted to get the outline.
> > You would know that if you read the full post since he gave a link to
> > what he already had using PHP. When he says:
> >
> >      "That site is also coded in php so I'm guessing that the
> >       watermark is added using a php technology."
> >
> > It means that he can presumably also generate a watermark with an
> > outline using PHP and GD.
> >
> > Comprendez vous?
> >   
> That's "comprenez-vous?" Comprends-tu? ;-)

That's why my kids are in French immersion :)

But moving along... you did "understand" it ;)

Cheers,
Rob.
-- 
http://www.interjinn.com
Application and Templating Framework for PHP


--- End Message ---
--- Begin Message ---
Robert Cummings wrote:
> On Tue, 2009-05-12 at 18:53 -0400, PJ wrote:
>   
>> Robert Cummings wrote:
>>     
>>> On Tue, 2009-05-12 at 16:31 -0400, tedd wrote:
>>>   
>>>       
>>>> At 3:48 PM -0400 5/12/09, Robert Cummings wrote:
>>>>     
>>>>         
>>>>> On Tue, 2009-05-12 at 09:54 -0400, tedd wrote:
>>>>>       
>>>>>           
>>>>>>  At 12:27 PM -0700 5/11/09, Daevid Vincent wrote:
>>>>>>  >  > > Here's an example with code:
>>>>>>  >>  >
>>>>>>  >  > > http://webbytedd.com/b/watermark/
>>>>>>  >>
>>>>>>  >>  I can't read the text over the dog's nose... ;)
>>>>>>  >
>>>>>>  >You're lucky. I don't see ANYTHING (as mentioned weeks ago already)...
>>>>>>  >
>>>>>>  >XP. FF 3.0.10 and IE 6.
>>>>>>  >
>>>>>>  >BOTH do not work.
>>>>>>  >
>>>>>>  >FF console says "startup is not defined" and "unknown property 'zoom'.
>>>>>>  >declaration dropped."
>>>>>>
>>>>>>  Daevid:
>>>>>>
>>>>>>  Interesting, try again:
>>>>>>
>>>>>>  http://webbytedd.com/b/watermark/
>>>>>>
>>>>>>  It works for me in IE6 and IE7 as well as FF on both XP and Vista.
>>>>>>
>>>>>>  All I did was to remove the references to empty js and css files.
>>>>>>         
>>>>>>             
>>>>> I think you missed the point of my comment about the black text over the
>>>>> dog's black nose. The whole thrust of this thread was to determine how
>>>>> to get the black outline around the text. The OP already had text on an
>>>>> image and I showed how to get an outline so that regardless of the image
>>>>> content the watermark would always be readable.
>>>>>
>>>>> Cheers,
>>>>> Rob.
>>>>>       
>>>>>           
>>>> Rob:
>>>>
>>>> I didn't miss it, I just didn't address that part of the post. Please 
>>>> note -- the OP originally asked:
>>>>
>>>> [1] --- quote
>>>>     
>>>>         
>>>>> That site is also coded in php so I'm guessing that the watermark is 
>>>>> added using a php technology.
>>>>>
>>>>> Can someone enlighten me on how that is done?
>>>>>       
>>>>>           
>>>> -- unquote
>>>>
>>>> And:
>>>>
>>>> [2] --- quote
>>>>     
>>>>         
>>>>> Also, while not php related, could someone enlighten me of a really 
>>>>> good font to use for watermarking images?
>>>>>       
>>>>>           
>>>> -- unquote
>>>>
>>>> While your post dealt with [2] mine was addressing [1]. Understand?
>>>>     
>>>>         
>>> Except he already had that part working. He wanted to get the outline.
>>> You would know that if you read the full post since he gave a link to
>>> what he already had using PHP. When he says:
>>>
>>>      "That site is also coded in php so I'm guessing that the
>>>       watermark is added using a php technology."
>>>
>>> It means that he can presumably also generate a watermark with an
>>> outline using PHP and GD.
>>>
>>> Comprendez vous?
>>>   
>>>       
>> That's "comprenez-vous?" Comprends-tu? ;-)
>>     
>
> That's why my kids are in French immersion :)
>
> But moving along... you did "understand" it ;)
>
> Cheers,
> Rob.
>   
To tell the truth, I've been following in a half hearted manner...
I'm a professional photographer and have not needed watermarking up to
now. But I gathered enough to understand what should be done... I see no
problem.
And if I ever stumble, I can always count on the e-mails I have backed
up or on the big hearts of the guys on the list. You're all great. Love
ya! ;-)

-- 
Hervé Kempf: "Pour sauver la planète, sortez du capitalisme."
-------------------------------------------------------------
Phil Jourdan --- p...@ptahhotep.com
   http://www.ptahhotep.com
   http://www.chiccantine.com/andypantry.php


--- End Message ---
--- Begin Message ---
On 5/11/09 11:58 AM, "Thodoris" <t...@kinetix.gr> wrote:

> 
>> On 11 May 2009 at 18:25, Thodoris wrote:
>> 
>>   
>>> Hi gang,
>>>     I am using phpmailer to send some mail notifications in an intranet
>>> I've made. This is a sample code:
>>>     
>> 
>>   
>>> $e->Subject = "This is δφκξγκδφη garbidge κηδφκξγσ";
>>>     
>> 
>> Hi,
>> 
>> I have had success with this in the past:
>> 
>> $subject  = "This is δφκξγκδφη garbidge κηδφκξγσ"; 
>> $e->Subject = mb_encode_mimeheader($subject, "UTF-8", "Q") ;
>> 
>> Regards
>> 
>> Ian
>>   
> 
> Thanks Ian this works in most cases but there are times that still
> breaks the subject. I have experimented with:
> 
> mb_encode_mimeheader($subject, "UTF-8", "B")
> 
> as well but nothing seems to be working without problems.

is it possible that in the problem cases the subject string isn't valid
utf-8?

you can check with mb_check_encoding($subject)

you can sanitize bad utf-8 with iconv("UTF-8","UTF-8//IGNORE",$subject)
though you probably won't get the string you want with that. when you don't
have other options, this will at least clean up bad encoding.



--- End Message ---
--- Begin Message ---
I have a server running that receives xml formatted events from other
services I have no control over.  For certain events the transfer-encoding
is chunked.

I was just doing

$input = file_get_contents('php://stdin');

and this works well until there is chunked input.  Then I tried

$handle = fopen('php://input', "rb");
$input = '';
while (!feof($handle)) {
  $input .= fread($handle, 8192);
}
fclose($handle);

And that gives about the same result, has anyone else come across this and
how did they solve it?

Thanks in advance

-- 
View this message in context: 
http://www.nabble.com/handling-chunked-input-from-php%3A--stdin-tp23512171p23512171.html
Sent from the PHP - General mailing list archive at Nabble.com.


--- End Message ---
--- Begin Message ---
whisperstream wrote:
> I have a server running that receives xml formatted events from other
> services I have no control over.  For certain events the transfer-encoding
> is chunked.
> 
> I was just doing
> 
> $input = file_get_contents('php://stdin');
> 
> and this works well until there is chunked input.  Then I tried
> 
> $handle = fopen('php://input', "rb");
> $input = '';
> while (!feof($handle)) {
>   $input .= fread($handle, 8192);
> }
> fclose($handle);
> 
> And that gives about the same result, has anyone else come across this and
> how did they solve it?
> 
> Thanks in advance
> 

There aren't really many examples around, but check
http_chunked_decode() from PECL.

-- 
Thanks!
-Shawn
http://www.spidean.com

--- End Message ---
--- Begin Message --- The database session management class I'm using is something I downloaded off the web several years ago.

I ported it to use mdb2 but it sometimes fails in a strange way if the session is expired or if the browser sends a session cookie that does not exist.

With error reporting turned off this isn't a problem. But with error reporting turned on, it breaks the xml. Since error reporting is turned on on my devel machine, this is an issue. The functions are hard coded to return true and it seems that when the write or gc function fails, the function of the site is not affected, but the error message that results at the end of the page causes an xml failure.

Where it fails is in the write class and the garbage collection.

Unfortunately I don't know enough about the internals of sessions to try to fix it, so I'm hoping someone can point me to a well tested database session management class written for pear mdb2.

All my googling thus far has turned up classes that use a specific database and I really want to avoid that, I'd rather use flat file than go that direction.
--- End Message ---
--- Begin Message ---
Michael A. Peters wrote:
The database session management class I'm using is something I downloaded off the web several years ago.

I ported it to use mdb2 but it sometimes fails in a strange way if the session is expired or if the browser sends a session cookie that does not exist.

With error reporting turned off this isn't a problem. But with error reporting turned on, it breaks the xml. Since error reporting is turned on on my devel machine, this is an issue. The functions are hard coded to return true and it seems that when the write or gc function fails, the function of the site is not affected, but the error message that results at the end of the page causes an xml failure.

Where it fails is in the write class and the garbage collection.

Unfortunately I don't know enough about the internals of sessions to try to fix it, so I'm hoping someone can point me to a well tested database session management class written for pear mdb2.

All my googling thus far has turned up classes that use a specific database and I really want to avoid that, I'd rather use flat file than go that direction.


I may have figured out the issue - the class seems to trying to be write the session data before it has created a new session when a session doesn't exist.

I'll play with it some more and see - but I would love a well tested existing class ...
--- End Message ---
--- Begin Message ---
<td class="text11">
<a href="some url"><img ></a><br><hr>
 <a href="some url">Home</a> | <b>My Interface</b><br> <br>

<h1 style="color:303030;">My Interface</h1><br>

<table>DONT READ TABLE</table><br>

<b><u>Step-By-Step Instructions:</u></b><br><br>

P tags
IMG tags

<table><tr><td><table>DONT READ</table></td></tr></table><hr>
 </td>

I am having trouble with the above HTML semantics. I just need to read the
content inside the TD with Class name text11(its the only class in the page
as well).
Need to omit the table inside as it contains Adsense ads.

Got to omit the first two A HREF tags as well. I'm not very good with PCRE
so failing to make it work.

Tried with DOMDocument but with the examples found I failed to achieve the
result.

$elements = $doc->getElementsById('table');

if (!is_null($elements)) {
  foreach ($elements as $element) {
    echo "<br/>". $element->nodeName. ": ";

    $nodes = $element->childNodes;
    foreach ($nodes as $node) {
      echo $node->nodeValue. "<br/>";
    }
  }
}

This above code only gets Texts inside but not Img.
Plz any help would be greatly appreciated.

--- End Message ---
--- Begin Message ---
RHEL5/PHP 5.1.6

I'm having some trouble getting the Fileinfo package working. It installed fine, and phpinfo() says it's enabled. But it consistently returns an empty string when getting the MIME of a file.

/usr/share/pear/bin/pecl install fileinfo
vi /etc/php.d/fileinfo.ini
extension=fileinfo.so

ln -s /usr/share/file/magic /etc/magic.mime

The code:

define('FINFO_PATH', '/usr/share/file/magic');
...
$fi = new finfo(FILEINFO_MIME, FINFO_PATH);
$type = $fi->file($file_path);

$type is always empty. And, yes, the path to the file is good.

This works fine on the dev box (PHP 5.2.6). Unfortunately, the decision to use RHEL5 for production was out of my hands and I'm stuck with this older version. At least, I'm thinking it might be due to that. I didn't see anything in the manual about it, though.

I did come across a post[1] online about doing file conversions where the guy mentions rolling an upgrade to 5.2.4 for RHEL5 but wasn't specific as to whether it was necessary to get Fileinfo to work at all. I might try using that upgrade but thought I'd do a sanity check here first. Any other reason it'd be returning nothing?



[1] http://bhuga.net/2008/07/setting-your-system-file-conversions-with-file-framework
--- End Message ---
--- Begin Message ---
Hi All,

please, I need to connect to IP via a specific port en validate my user name
and password to get data.

Port :   XXX7X

Internet ip          195.19.XX.1XX
please can some help with the idea of achieving it in php. please see the
format below:

[*Session Initialization*
A session begins with the client establishing a TCP session and sending a
login packet. If a login
packet is not received within 30 seconds the server will terminate the
session. Once a login
packet is received, the server will respond with a login accepted packet and
begin sending
sequenced data, or reject the login and terminate the connection.
The session does not actually send explicit sequence numbers with each
message, but instead
relies upon the concept of implied sequence numbers. The first sequenced
message of the day
should be considered ‘1’, and each subsequent sequenced message increments
this. When
recovering a session, you simply count the number of sequenced messages you
have received
to determine what sequence number you want to recover from. For example, if
you login and
receive 50 sequenced messages and then are disconnected, when you reconnect
you would
login and provide your next expected sequence, in this case 51, and the
session will continue
from that point.]



-- 
Best Wishes
A Williams

--- End Message ---

Reply via email to