[PHP] How would you create a tracking pixel?

2005-07-25 Thread Brian Dunning
I want to create a pixel that can be used to track certain activity  
on the site. I've got it working fine: I just mod_rewrite  
spacer.gif to a PHP app that does what I want it to do; but then I  
don't know how to actually return a blank pixel. Can anyone point me  
in the right direction?


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



Re: [PHP] How would you create a tracking pixel?

2005-07-25 Thread Philip Hallstrom
I want to create a pixel that can be used to track certain activity on the 
site. I've got it working fine: I just mod_rewrite spacer.gif to a PHP app 
that does what I want it to do; but then I don't know how to actually return 
a blank pixel. Can anyone point me in the right direction?


Create a 1x1 blank pixel gif and then...

Header(Content-type: image/gif);
readfile(/path/to/spacer.gif);

Why use mod_rewrite?  Why not just do something like...

href=/path/to/phpapp.php/spacer.gif

?

-philip

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



Re: [PHP] How would you create a tracking pixel?

2005-07-25 Thread Matt Darby
A blank (transparent) pixel would be more difficult, but a simple 
colored pixel would be easy:


In target file:
img src=pixel.php

pixel.php

?
$im=imagecreate(1,1);
$white=imagecolorallocate($im,255,255,255);
imagesetpixel($im,1,1,$white);
header(content-type:image/jpg);
imagejpeg($im);
imagedestroy($im);
?

I guess this begs the question, why not use session variables to track 
activity??


Matt Darby

Brian Dunning wrote:

I want to create a pixel that can be used to track certain activity  
on the site. I've got it working fine: I just mod_rewrite  
spacer.gif to a PHP app that does what I want it to do; but then I  
don't know how to actually return a blank pixel. Can anyone point me  
in the right direction?




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



Re: [PHP] How would you create a tracking pixel?

2005-07-25 Thread Brian Dunning

Thanks. A transparent pixel is what I'll need - any guidance on that?


On Jul 25, 2005, at 12:37 PM, Matt Darby wrote:

A blank (transparent) pixel would be more difficult, but a simple  
colored pixel would be easy:


In target file:
img src=pixel.php

pixel.php

?
$im=imagecreate(1,1);
$white=imagecolorallocate($im,255,255,255);
imagesetpixel($im,1,1,$white);
header(content-type:image/jpg);
imagejpeg($im);
imagedestroy($im);
?

I guess this begs the question, why not use session variables to  
track activity??


Matt Darby

Brian Dunning wrote:


I want to create a pixel that can be used to track certain  
activity  on the site. I've got it working fine: I just  
mod_rewrite  spacer.gif to a PHP app that does what I want it to  
do; but then I  don't know how to actually return a blank pixel.  
Can anyone point me  in the right direction?






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



Re: [PHP] How would you create a tracking pixel?

2005-07-25 Thread Brian Dunning
I did some more STFW and came up with this - I'll try it to see if it  
works.


Header( Content-type: image/gif);
printf (%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c% 
c%c%c%c%c%c%c%c%c%c%c%c%c, 
71,73,70,56,57,97,1,0,1,0,128,255,0,192,192,192,0,0,0,33,249,4,1,0,0,0,0 
,44,0,0,0,0,1,0,1,0,0,2,2,68,1,0,59);


I guess this begs the question, why not use session variables to  
track activity??


A tracking pixel is used in a block of code that you provide to other  
people to post on their sites - i.e. for a web counter, ads, etc.


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