Jump to content

Pixel Tracking


Drongo_III

Recommended Posts

I'm currently planning out a pixel tracking PHP script. 

 

From reading around there appears to be two ways to serve a pixel back to in the request:

 

1) creating a 1x1 pixel image using GD library

2) sending back 200 code in the header and serving no image at all

 

However, using GD library seems like quite an expensive way to serve a 1x1 pixel. So what I wanted to know was if I went down this route is there any advantage of using GD library over just serving a 1x1 pixel image (i.e. a 'physical' image) that's actually stored on the server?

 

Any advice is appreciated!

 

Link to comment
https://forums.phpfreaks.com/topic/295778-pixel-tracking/
Share on other sites

Why go through GD?

1. Make a 1x1 transparent pixel in MS Paint or whatever, save as GIF for the small size.

2. Do echo base64_encode(file_get_contents("/path/to/pixel.gif")) and copy that.

3. Paste it in code as

header("Content-Type: image/gif");
echo base64_decode("base64 encoded stuff here");
Link to comment
https://forums.phpfreaks.com/topic/295778-pixel-tracking/#findComment-1509680
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.