homepage Welcome to WebmasterWorld Guest from 54.198.8.124
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Pubcon Platinum Sponsor 2014
Visit PubCon.com
Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
Forum Library, Charter, Moderators: coopster & jatar k

PHP Server Side Scripting Forum

    
Views tracking with a fake image
What is better: png or gif?
GreenLeaf




msg:1294990
 6:38 pm on Mar 18, 2005 (gmt 0)

In different code sources i saw 2 methods of tracking views (for example, newsletter open rate) with 'fake' image:

header("Content-Type: image/png");
print base64_decode('iVBORw0KGgoAAAANSUhEUgAAAAEAAAABAQMAAAAl21bKAAAABGdBTUEAALGPC/xhBQAAAAZQTFRF////
AAAAVcLTfgAAAAF0Uk5TAEDm2GYAAAABYktHRACIBR1IAAAACXBIWXMAAAsSAAALEgHS3X78AAAAB3RJTUUH0gQCEx05cq
KA8gAAAApJREFUeJxjYAAAAAIAAUivpHEAAAAASUVORK5CYII=');
(without word wrap, of course)

and

Header("Content-Type: image/gif");
Header("Content-Length: 43");
echo chr(0x47).chr(0x49).chr(0x46).chr(0x38).chr(0x39).chr(0x61).chr(0x01).chr(0x00).
chr(0x01).chr(0x00).chr(0x80).chr(0x00).chr(0x00).chr(0x04).chr(0x02).chr(0x04).
chr(0x00).chr(0x00).chr(0x00).chr(0x21).chr(0xF9).chr(0x04).chr(0x01).chr(0x00).
chr(0x00).chr(0x00).chr(0x00).chr(0x2C).chr(0x00).chr(0x00).chr(0x00).chr(0x00).
chr(0x01).chr(0x00).chr(0x01).chr(0x00).chr(0x00).chr(0x02).chr(0x02).chr(0x44).
chr(0x01).chr(0x00).chr(0x3B);

Which is better?
Thanks

 

jatar_k




msg:1294991
 10:13 pm on Mar 18, 2005 (gmt 0)

I don't see why it would matter

GreenLeaf




msg:1294992
 12:06 am on Mar 19, 2005 (gmt 0)

Maybe there is some difference in gif/png support in various applications/browsers?

jatar_k




msg:1294993
 12:14 am on Mar 19, 2005 (gmt 0)

aahhh, missed that, sry, I would say gif

GreenLeaf




msg:1294994
 8:33 pm on Mar 19, 2005 (gmt 0)

Thanks!

By the way, is that code in examples valid?

jatar_k




msg:1294995
 1:58 am on Mar 20, 2005 (gmt 0)

I imagine it works for what they are doing but you may need to customize it for what you are particularly doing.

GreenLeaf




msg:1294996
 12:17 pm on Mar 21, 2005 (gmt 0)

Customize it? I thought that it was a code for 1x1 image's output. How it can be customized?
Thanks.

jatar_k




msg:1294997
 5:50 pm on Mar 21, 2005 (gmt 0)

just try it, see if it works. :)

I haven't tried it

GreenLeaf




msg:1294998
 1:04 am on Mar 22, 2005 (gmt 0)

Thanks a lot for your answers!

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved