php-general Digest 13 May 2010 08:02:02 -0000 Issue 6741

Topics (messages 305129 through 305139):

Re: regexp questions
        305129 by: Spud. Ivan.
        305130 by: Ashley Sheridan
        305131 by: Spud. Ivan.
        305132 by: Ashley Sheridan
        305133 by: Karl DeSaulniers

Re: In need of CVS/SVN checkout script for Production servers [solved]
        305134 by: Daevid Vincent

GD - import a PNG image and make transparant
        305135 by: Alex Davies
        305136 by: Karl DeSaulniers
        305137 by: Ashley Sheridan

function/class to convert IDN (Puny-Code)?
        305138 by: Michelle Konzack

stristr query trouble
        305139 by: Ron Piggott

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 ---

 

> Date: Tue, 11 May 2010 15:38:41 -0700
> From: [email protected]
> To: [email protected]
> CC: [email protected]
> Subject: Re: [PHP] regexp questions
> 
> Spud. Ivan. wrote:
> > 
> > I think we've not so much only with the regex, but maybe you can tell me 
> > somethin helpful ;)
> > 
> > /Word1:<\/a><\/h4>\(<a 
> > href=\"http:\/\/www.thiswebsite.com\/some-script.php\">fir.*?st 
> > word.*?(.*)Word2:<\/a><\/h4><ul>(.*)Second 
> > word:<\/a><\/h4><ul>(.*)Word3:<\/a><\/h4><ul>(.*)rd word/is
> > 
> > Thanks.
> > I.Lopez.
> > 
> > On 05/11/2010 09:56 AM, Spud. Ivan. wrote:
> >> But it doesn't explain why my regexps work fine within php 5.1 but 5.3
> >>
> >> Ivan.
> >>
> > 
> > Post a regex and what you think it should match but doesn't.
> > 
> > 
> 
> Again...
> 
> Why don't you show us an example of what it is you are trying to match this
> against. Then, after that example, show us what you would like to see as the
> output.
> 
> Then, send us a copy of the code you are trying to use to make it all happen.
> 
> -- 
> Jim Lucas
> 
> "Some men are born to greatness, some achieve greatness,
> and some have greatness thrust upon them."
> 
> Twelfth Night, Act II, Scene V
> by William Shakespeare


 

I'm sorry Jim, but as majority of regexp, I can't explain you what I want with 
words...

I simply want to pick specific text at  very specific places inside the html.

 

I'm sending you to your email the html and regex so you can test it if you want 
:)

 

Thanks.

I. Lopez.

 
                                          
_________________________________________________________________
Consejos para seducir ¿Puedes conocer gente nueva a través de Internet? 
¡Regístrate ya!
http://contactos.es.msn.com/?mtcmk=015352

--- End Message ---
--- Begin Message ---
On Wed, 2010-05-12 at 18:13 +0200, Spud. Ivan. wrote:

> 
>  
> 
> > Date: Tue, 11 May 2010 15:38:41 -0700
> > From: [email protected]
> > To: [email protected]
> > CC: [email protected]
> > Subject: Re: [PHP] regexp questions
> > 
> > Spud. Ivan. wrote:
> > > 
> > > I think we've not so much only with the regex, but maybe you can tell me 
> > > somethin helpful ;)
> > > 
> > > /Word1:<\/a><\/h4>\(<a 
> > > href=\"http:\/\/www.thiswebsite.com\/some-script.php\">fir.*?st 
> > > word.*?(.*)Word2:<\/a><\/h4><ul>(.*)Second 
> > > word:<\/a><\/h4><ul>(.*)Word3:<\/a><\/h4><ul>(.*)rd word/is
> > > 
> > > Thanks.
> > > I.Lopez.
> > > 
> > > On 05/11/2010 09:56 AM, Spud. Ivan. wrote:
> > >> But it doesn't explain why my regexps work fine within php 5.1 but 5.3
> > >>
> > >> Ivan.
> > >>
> > > 
> > > Post a regex and what you think it should match but doesn't.
> > > 
> > > 
> > 
> > Again...
> > 
> > Why don't you show us an example of what it is you are trying to match this
> > against. Then, after that example, show us what you would like to see as the
> > output.
> > 
> > Then, send us a copy of the code you are trying to use to make it all 
> > happen.
> > 
> > -- 
> > Jim Lucas
> > 
> > "Some men are born to greatness, some achieve greatness,
> > and some have greatness thrust upon them."
> > 
> > Twelfth Night, Act II, Scene V
> > by William Shakespeare
> 
> 
>  
> 
> I'm sorry Jim, but as majority of regexp, I can't explain you what I want 
> with words...
> 
> I simply want to pick specific text at  very specific places inside the html.
> 
>  
> 
> I'm sending you to your email the html and regex so you can test it if you 
> want :)
> 
>  
> 
> Thanks.
> 
> I. Lopez.
> 
>  
>                                         
> _________________________________________________________________
> Consejos para seducir ¿Puedes conocer gente nueva a través de Internet? 
> ¡Regístrate ya!
> http://contactos.es.msn.com/?mtcmk=015352


It might be better to use some of the DOM functions for something like
this. You can pull out specific tags and tag content as you need. It's
better to rely on DOM functions for these sorts of things than using
regular expressions.

Thanks,
Ash
http://www.ashleysheridan.co.uk



--- End Message ---
--- Begin Message ---

 


Subject: RE: [PHP] regexp questions
From: [email protected]
To: [email protected]
CC: [email protected]
Date: Wed, 12 May 2010 17:11:11 +0100

On Wed, 2010-05-12 at 18:13 +0200, Spud. Ivan. wrote: 

 

> Date: Tue, 11 May 2010 15:38:41 -0700
> From: [email protected]
> To: [email protected]
> CC: [email protected]
> Subject: Re: [PHP] regexp questions
> 
> Spud. Ivan. wrote:
> > 
> > I think we've not so much only with the regex, but maybe you can tell me 
> > somethin helpful ;)
> > 
> > /Word1:<\/a><\/h4>\(<a 
> > href=\"http:\/\/www.thiswebsite.com\/some-script.php\">fir.*?st 
> > word.*?(.*)Word2:<\/a><\/h4><ul>(.*)Second 
> > word:<\/a><\/h4><ul>(.*)Word3:<\/a><\/h4><ul>(.*)rd word/is
> > 
> > Thanks.
> > I.Lopez.
> > 
> > On 05/11/2010 09:56 AM, Spud. Ivan. wrote:
> >> But it doesn't explain why my regexps work fine within php 5.1 but 5.3
> >>
> >> Ivan.
> >>
> > 
> > Post a regex and what you think it should match but doesn't.
> > 
> > 
> 
> Again...
> 
> Why don't you show us an example of what it is you are trying to match this
> against. Then, after that example, show us what you would like to see as the
> output.
> 
> Then, send us a copy of the code you are trying to use to make it all happen.
> 
> -- 
> Jim Lucas
> 
> "Some men are born to greatness, some achieve greatness,
> and some have greatness thrust upon them."
> 
> Twelfth Night, Act II, Scene V
> by William Shakespeare


 

I'm sorry Jim, but as majority of regexp, I can't explain you what I want with 
words...

I simply want to pick specific text at  very specific places inside the html.

 

I'm sending you to your email the html and regex so you can test it if you want 
:)

 

Thanks.

I. Lopez.

 
                                          
_________________________________________________________________
Consejos para seducir ¿Puedes conocer gente nueva a través de Internet? 
¡Regístrate ya!
http://contactos.es.msn.com/?mtcmk=015352

It might be better to use some of the DOM functions for something like this. 
You can pull out specific tags and tag content as you need. It's better to rely 
on DOM functions for these sorts of things than using regular expressions.






Thanks,
Ash
http://www.ashleysheridan.co.uk



>

 

 

But If I remove tags, I can't match this specific place, because are just these 
tags who distinct the place where to match.

 

I.Lopez.


 
                                          
_________________________________________________________________
Consejos para seducir ¿Puedes conocer gente nueva a través de Internet? 
¡Regístrate ya!
http://contactos.es.msn.com/?mtcmk=015352

--- End Message ---
--- Begin Message ---
On Wed, 2010-05-12 at 18:23 +0200, Spud. Ivan. wrote:

> 
>  
> 
> 
> Subject: RE: [PHP] regexp questions
> From: [email protected]
> To: [email protected]
> CC: [email protected]
> Date: Wed, 12 May 2010 17:11:11 +0100
> 
> On Wed, 2010-05-12 at 18:13 +0200, Spud. Ivan. wrote: 
> 
>  
> 
> > Date: Tue, 11 May 2010 15:38:41 -0700
> > From: [email protected]
> > To: [email protected]
> > CC: [email protected]
> > Subject: Re: [PHP] regexp questions
> > 
> > Spud. Ivan. wrote:
> > > 
> > > I think we've not so much only with the regex, but maybe you can tell me 
> > > somethin helpful ;)
> > > 
> > > /Word1:<\/a><\/h4>\(<a 
> > > href=\"http:\/\/www.thiswebsite.com\/some-script.php\">fir.*?st 
> > > word.*?(.*)Word2:<\/a><\/h4><ul>(.*)Second 
> > > word:<\/a><\/h4><ul>(.*)Word3:<\/a><\/h4><ul>(.*)rd word/is
> > > 
> > > Thanks.
> > > I.Lopez.
> > > 
> > > On 05/11/2010 09:56 AM, Spud. Ivan. wrote:
> > >> But it doesn't explain why my regexps work fine within php 5.1 but 5.3
> > >>
> > >> Ivan.
> > >>
> > > 
> > > Post a regex and what you think it should match but doesn't.
> > > 
> > > 
> > 
> > Again...
> > 
> > Why don't you show us an example of what it is you are trying to match this
> > against. Then, after that example, show us what you would like to see as the
> > output.
> > 
> > Then, send us a copy of the code you are trying to use to make it all 
> > happen.
> > 
> > -- 
> > Jim Lucas
> > 
> > "Some men are born to greatness, some achieve greatness,
> > and some have greatness thrust upon them."
> > 
> > Twelfth Night, Act II, Scene V
> > by William Shakespeare
> 
> 
>  
> 
> I'm sorry Jim, but as majority of regexp, I can't explain you what I want 
> with words...
> 
> I simply want to pick specific text at  very specific places inside the html.
> 
>  
> 
> I'm sending you to your email the html and regex so you can test it if you 
> want :)
> 
>  
> 
> Thanks.
> 
> I. Lopez.
> 
>  
>                                         
> _________________________________________________________________
> Consejos para seducir ¿Puedes conocer gente nueva a través de Internet? 
> ¡Regístrate ya!
> http://contactos.es.msn.com/?mtcmk=015352
> 
> It might be better to use some of the DOM functions for something like this. 
> You can pull out specific tags and tag content as you need. It's better to 
> rely on DOM functions for these sorts of things than using regular 
> expressions.
> 
> 
> 
> 
> 
> 
> Thanks,
> Ash
> http://www.ashleysheridan.co.uk
> 
> 
> 
> >
> 
>  
> 
> 
> 
> But If I remove tags, I can't match this specific place, because are just 
> these tags who distinct the place where to match.
> 
>  
> 
> I.Lopez.
> 
> 
>  
>                                         
> _________________________________________________________________
> Consejos para seducir ¿Puedes conocer gente nueva a través de Internet? 
> ¡Regístrate ya!
> http://contactos.es.msn.com/?mtcmk=015352


It depends what you need to do. If you want to match specific tags, then
something like getElementsByTagName() (I believe this function exists in
the set of DOM functions) would very easily grab all those tags so you
can work on them. I don't see much that a regex could do here that the
DOM can't handle.

Thanks,
Ash
http://www.ashleysheridan.co.uk



--- End Message ---
--- Begin Message ---

On May 12, 2010, at 11:20 AM, Ashley Sheridan wrote:

On Wed, 2010-05-12 at 18:23 +0200, Spud. Ivan. wrote:





Subject: RE: [PHP] regexp questions
From: [email protected]
To: [email protected]
CC: [email protected]
Date: Wed, 12 May 2010 17:11:11 +0100

On Wed, 2010-05-12 at 18:13 +0200, Spud. Ivan. wrote:



Date: Tue, 11 May 2010 15:38:41 -0700
From: [email protected]
To: [email protected]
CC: [email protected]
Subject: Re: [PHP] regexp questions

Spud. Ivan. wrote:

I think we've not so much only with the regex, but maybe you can tell me somethin helpful ;)

/Word1:<\/a><\/h4>\(<a href=\"http:\/\/www.thiswebsite.com\/some- script.php\">fir.*?st word.*?(.*)Word2:<\/a><\/h4><ul>(.*)Second word:<\/a><\/h4><ul>(.*)Word3:<\/a><\/h4><ul>(.*)rd word/is

Thanks.
I.Lopez.

On 05/11/2010 09:56 AM, Spud. Ivan. wrote:
But it doesn't explain why my regexps work fine within php 5.1 but 5.3

Ivan.


Post a regex and what you think it should match but doesn't.



Again...

Why don't you show us an example of what it is you are trying to match this against. Then, after that example, show us what you would like to see as the
output.

Then, send us a copy of the code you are trying to use to make it all happen.

--
Jim Lucas

"Some men are born to greatness, some achieve greatness,
and some have greatness thrust upon them."

Twelfth Night, Act II, Scene V
by William Shakespeare




I'm sorry Jim, but as majority of regexp, I can't explain you what I want with words...

I simply want to pick specific text at very specific places inside the html.



I'm sending you to your email the html and regex so you can test it if you want :)



Thanks.

I. Lopez.


                                        
_________________________________________________________________
Consejos para seducir ¿Puedes conocer gente nueva a través de Internet? ¡Regístrate ya!
http://contactos.es.msn.com/?mtcmk=015352

It might be better to use some of the DOM functions for something like this. You can pull out specific tags and tag content as you need. It's better to rely on DOM functions for these sorts of things than using regular expressions.






Thanks,
Ash
http://www.ashleysheridan.co.uk









But If I remove tags, I can't match this specific place, because are just these tags who distinct the place where to match.



I.Lopez.



                                        
_________________________________________________________________
Consejos para seducir ¿Puedes conocer gente nueva a través de Internet? ¡Regístrate ya!
http://contactos.es.msn.com/?mtcmk=015352


It depends what you need to do. If you want to match specific tags, then something like getElementsByTagName() (I believe this function exists in
the set of DOM functions) would very easily grab all those tags so you
can work on them. I don't see much that a regex could do here that the
DOM can't handle.

Thanks,
Ash
http://www.ashleysheridan.co.uk



Dont know if you found your solution or not, but here is a good website for regexp.

http://lawrence.ecorp.net/inet/samples/regexp-intro.php

HTH,


Karl DeSaulniers
Design Drumm
http://designdrumm.com


--- End Message ---
--- Begin Message ---
 

> -----Original Message-----
> From: tedd [mailto:[email protected]] 
> Sent: Thursday, May 06, 2010 9:06 AM
> To: Daevid Vincent; [email protected]
> Subject: RE: [PHP] In need of CVS/SVN checkout script for 
> Production servers [solved]
> 
> At 5:43 PM -0700 5/5/10, Daevid Vincent wrote:
> >  > -----Original Message-----
> >  > From: tedd [mailto:[email protected]]
> >  > Sent: Wednesday, May 05, 2010 8:19 AM
> >  > To: Daevid Vincent; [email protected]
> >  > Subject: RE: [PHP] In need of CVS/SVN checkout script for
> >  >-snip- stuff which fell on deaf ears
> >  >
> >  > tedd
> >
> >*sigh* once again you people focus on something SOOOO off 
> topic compared to
> >the meat of the thread -- which is a production repository 
> checkout script.
> 
> Let me get this right -- you created a repository for people to 
> check-out/deposit scripts, but then deny some people access because 
> of their choice of browser? That seems counter productive. Do your 
> scripts only work for certain browsers?

No. I created a little miniscule dumping ground for some useful scripts *I*
use, and if someone else can use them, then feel free. I don't support
them. I don't even pretend to maintain them once posted. They are what they
are.

> ---------------
> 
> >As for my site.
> >
> >[*] I really don't care about the fringe browsers...
> 
> That obvious. But what happens when your client's do care?

I make 6+ figures and have so for years. I'm not a freelancer. My
experience, networking and resume get me jobs, not my home page. I don't
have "clients".

> ---------------
> 
> >     Give me a break man. I've got more important things to do.
> 
> Let me get this right --  it's more important to do something else 
> than to fix something you did wrong? If you're gong to take the time 
> to do something, then why not do it right? Remember, this is an 
> example of *your* work.

No. Examples of my "work" are what I get PAID for. This is simply a
personal page and a "hobby".

> I spend a lot of my time making my code as good as I can get it, not 
> because of clients, or what others might think, but because of me. 
> It's a personal choice of mine to always learn and improve. If you 
> allow "I've got more important things to do" altitude to excuse bad 
> code, then you are only hurting yourself in the long run. I think you 
> know that.
> 
> ---------------
> 
> >[*] Honestly, I also dislike Apple. I think it's stupid for 
> them to make a
> >browser. I think they make crappy products.
> 
> LOL!
> 
> So you think that M$ makes better stuff, like IE6? Even Apple's worst 
> browser was better than that!

Yes I do. I won't get into an OS war with you though.

XP is the best OS thus far. Everything in the world supports it. It is
stable and fast. 

As for browser, I use FF for developing (mostly for Firebug) and some
flavor of IE (usually all three to test with) as that is what most people
still use. IE6 is still the standard default browser Panasonic uses (that's
5000 users alone). Many other large enterprise companies also stick with
XP/IE6. Only slowly are they migrating to IE8.

> ---------------
> 
> >As for CSS, inline styles, separation of logic, and all that 
> other stuff
> >you ASSUME I don't use -- you are very wrong. I just happen 
> to use a lot of
> >PHP to dynamically create various parts.
> 
> I'm not ASSUMING anything -- it's a fact the site you provided 
> doesn't follow said practices.
> 
> Additionally, you seem to be blaming PHP for the bad code but the 
> fact is you're just being lazy. Many of my sites are dynamically 
> created via PHP but still generate good code. One doesn't exclude the 
> other.

Not blaming at all. Just saying that while you see "inline" JS or CSS, it's
actually not as it appears. Some of that is generated in routines or loops.

> The point is that you want us to go to your site to check-out/provide 
> scripts, but the site you provided reeks of bad code. That's a bit 
> like a dinner saying "Don't mind the dirty silverware, just eat the 
> food."

No. I don't "want" you to do anything. I offered up some free code. Take it
or leave it. If you want it, then the least you can do is use the required
browsers (which mostly everyone has already installed) to get to it. In
fact, if you're such a die-hard Safari user, just change your USER_AGENT
string and it will probably work. No sweat off my balls if you don't.

> ---------------
> 
> >In some cases I inline styles where they are used one time or used 
> >in a PHP function.
> 
> Okay, then why not learn how to do it right? Using a validator can 
> help you improve your code. Standards are not just for an elite group 
> of people but rather to improve overall coding practices. What's 
> wrong with that? Validation is giving you the opportunity to 
> critically review your code.
> 

What part about "coded 4 years ago" don't you understand?

> ---------------
> 
> >If I had to choose between my
> >daevid.com site and one of the three you (presumably) 
> illustrate as beacons
> >of "the way to do it" (http://sperling.com  http://ancientstones.com
> >http://earthstones.com), then I would take my site any day 
> of the week.
> 
> Go ahead -- but many people won't -- as shown by your site's NULL 
> Google PageRank.

Again, you seem to think I give a flying fig about my PERSONAL PAGE
RANKING. 

In fact, I'm happy to have it live in obscurity and only for those that I
want to see it as it has some personal information, it keeps me under the
radar of hackers, and it allows me to share with friends and family without
exposing too much to the world.

Your numbers are mistaken:
http://www.prchecker.info/check_page_rank.php
Sperling.com is 5/10
Daevid.com is a 2/10 
Ancientstones.com is 2/10
Earthstones.com is 2/10

And Alexa ranks:

   143,591 http://www.alexa.com/siteinfo/sperling.com
 6,093,223 http://www.alexa.com/siteinfo/daevid.com
 7,424,118 http://www.alexa.com/siteinfo/earthstones.com
16,097,191 http://www.alexa.com/siteinfo/ancientstones.com

So people in glass houses shouldn't throw stones -- Ancient or Earthen...

(And I'll even say congratulations on that sperling.com ranking. It's
impressive to be that low.)

> At least my sites have traffic. For example, according to today's 
> Google Analyitics report during the last 30 days my sperling.com site 
> has received 5970 unique visitors -- I'll take *that* any day of the 
> week over shutting people out.

Again. Don't care how many visitors I get to my personal site. I'm not
selling ad banners, so all visitors do is bog down my server and bandwidth.
If I could restrict traffic to ONLY those I wanted to see it, I would.

> Daevid -- after all is said and done, I know you are better than 
> this. I'm not sure why you are arguing the point.

I'm not sure either. In fact, you're right. I *am* better than this. And
for the same reasons I won't bother to update my personal site anytime soon
for 10% of the entire fringe browser market, I have more important things
to do with my time -- like my day job or spend it with my family and
friends.

> Cheers,
> 
> tedd


--- End Message ---
--- Begin Message ---
Hi,

I am trying to import a PNG image from disk, place it on top of a
transparant image created in GD and output it to the browser. In the case of
a low opacity setting, I would expect to see the background colour from the
HTML page.

If I set the opacity to 0, everything works - I end up with a transparant
image.

However, if I set it for any value >0 (even 1) instead of  a
very-faint-image the whole thing goes black. As the opacity level goes up
from 0, the amount of black reduces and the amount of imported image
increases - but this is not what I want.

I am using this code:

<?php
$src = imagecreatefrompng('test.png');
$img_width  = imagesx($src);
$img_height = imagesy($src);

// Create trans image
$dest = imagecreatetruecolor($img_width, $img_height);
//imagesavealpha($dest, true); // This has no effect it appears
$trans_colour = imagecolorallocatealpha($dest, 0, 255, 0, 128);

// Make the background transparent
imagecolortransparent($dest, $trans_colour);
//imagefill($dest, 0, 0, $trans_colour); // This does not work

// Merge src on top of dest, with opacity of 1 in this case
imagecopymerge($dest, $src, 0, 0, 0, 0, $img_width, $img_height, 1);

// Output and free from memory
header('Content-Type: image/png');
imagepng($dest);
?>

The images that this outputs, at opacity levels 0,1 and 80 on a red and
green background (screenshots of a HTML page) can be downloaded from
http://www.box.net/shared/h9zn4tjgro

Any help appreciated!

Cheers,

Alex

--- End Message ---
--- Begin Message ---
Hi Alex,
I have a php file I made just a few months ago.
It takes a gif, jpeg or png of any size and sizes it proportionately to a specified size and then outputs a png. If the image is a transparent png or transparent gif, it will still hold the transparency. This is just a test page and it tested ok for me, but it is my first one. I also tested it on PHP 5. Dont know about compatibility to older versions.
Knowing that, here you go.

http://designdrumm.com/upload_images_test.php.zip

HTH,

Karl


On May 12, 2010, at 6:12 PM, Alex Davies wrote:

Hi,

I am trying to import a PNG image from disk, place it on top of a
transparant image created in GD and output it to the browser. In the case of a low opacity setting, I would expect to see the background colour from the
HTML page.

If I set the opacity to 0, everything works - I end up with a transparant
image.

However, if I set it for any value >0 (even 1) instead of  a
very-faint-image the whole thing goes black. As the opacity level goes up
from 0, the amount of black reduces and the amount of imported image
increases - but this is not what I want.

I am using this code:

<?php
$src = imagecreatefrompng('test.png');
$img_width  = imagesx($src);
$img_height = imagesy($src);

// Create trans image
$dest = imagecreatetruecolor($img_width, $img_height);
//imagesavealpha($dest, true); // This has no effect it appears
$trans_colour = imagecolorallocatealpha($dest, 0, 255, 0, 128);

// Make the background transparent
imagecolortransparent($dest, $trans_colour);
//imagefill($dest, 0, 0, $trans_colour); // This does not work

// Merge src on top of dest, with opacity of 1 in this case
imagecopymerge($dest, $src, 0, 0, 0, 0, $img_width, $img_height, 1);

// Output and free from memory
header('Content-Type: image/png');
imagepng($dest);
?>

The images that this outputs, at opacity levels 0,1 and 80 on a red and
green background (screenshots of a HTML page) can be downloaded from
http://www.box.net/shared/h9zn4tjgro

Any help appreciated!

Cheers,

Alex

Karl DeSaulniers
Design Drumm
http://designdrumm.com


--- End Message ---
--- Begin Message ---
On Thu, 2010-05-13 at 00:12 +0100, Alex Davies wrote:

> Hi,
> 
> I am trying to import a PNG image from disk, place it on top of a
> transparant image created in GD and output it to the browser. In the case of
> a low opacity setting, I would expect to see the background colour from the
> HTML page.
> 
> If I set the opacity to 0, everything works - I end up with a transparant
> image.
> 
> However, if I set it for any value >0 (even 1) instead of  a
> very-faint-image the whole thing goes black. As the opacity level goes up
> from 0, the amount of black reduces and the amount of imported image
> increases - but this is not what I want.
> 
> I am using this code:
> 
> <?php
> $src = imagecreatefrompng('test.png');
> $img_width  = imagesx($src);
> $img_height = imagesy($src);
> 
> // Create trans image
> $dest = imagecreatetruecolor($img_width, $img_height);
> //imagesavealpha($dest, true); // This has no effect it appears
> $trans_colour = imagecolorallocatealpha($dest, 0, 255, 0, 128);
> 
> // Make the background transparent
> imagecolortransparent($dest, $trans_colour);
> //imagefill($dest, 0, 0, $trans_colour); // This does not work
> 
> // Merge src on top of dest, with opacity of 1 in this case
> imagecopymerge($dest, $src, 0, 0, 0, 0, $img_width, $img_height, 1);
> 
> // Output and free from memory
> header('Content-Type: image/png');
> imagepng($dest);
> ?>
> 
> The images that this outputs, at opacity levels 0,1 and 80 on a red and
> green background (screenshots of a HTML page) can be downloaded from
> http://www.box.net/shared/h9zn4tjgro
> 
> Any help appreciated!
> 
> Cheers,
> 
> Alex


How exactly are you setting the opacity for the image? The traditional
way is to use imagecolorallocatealpha() on the source.

Thanks,
Ash
http://www.ashleysheridan.co.uk



--- End Message ---
--- Begin Message ---
Hello,

while reading RFC3490 (plus 3454/3491/3492) and before I am  ongoing  to
reinvent the wheel here the question:

    Does someone HAVE or know a function/class which
    does the IDN conversion "toASCII" and "toUNICODE"?

Note:   The C Source-Code is included in RFC3492 and
        can more or less easily converted to PHP.

Thanks, Greetings and nice Day/Evening
    Michelle Konzack
    Systemadministrator

-- 
##################### Debian GNU/Linux Consultant ######################
   Development of Intranet and Embedded Systems with Debian GNU/Linux

itsyst...@tdnet France           itsyst...@tdnet UG (haftungsbeschränkt)
Gesch. Michelle Konzack          Gesch. Michelle Konzack

Apt. 917 (homeoffice)
50, rue de Soultz               Kinzigstraße 17
67100 Strasbourg/France         77694 Kehl/Germany
Tel: +33-6-61925193 mobil       Tel: +49-177-9351947 mobil
Tel: +33-9-52705884 fix

<http://www.itsystems.tamay-dogan.net/>  <http://www.flexray4linux.org/>
<http://www.debian.tamay-dogan.net/>         <http://www.can4linux.org/>

Jabber [email protected]
ICQ    #328449886

Linux-User #280138 with the Linux Counter, http://counter.li.org/

Attachment: signature.pgp
Description: Digital signature


--- End Message ---
--- Begin Message ---

I am not understanding why 'true' isn't the result of this syntax because
$subjects equals:

$subjects = "Delivery Status Notification(Failure)";

Here is my syntax:

if ( stristr( $subjects, "Delivery Status Notifcation(Failure)" ) ) {
$TIRSFlag = true; 
echo "true";
}



--- End Message ---

Reply via email to