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
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");
Edited by requinix
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.