drmet46444 2019-08-02 14:29
浏览 63

1Mb跟踪像素

I am seeking to add a tracking pixel to my website which is 1Mb in size. Ideally this should be 1x1 px and minimize the amount of effort used to render in the browser.

We will be using this on our intranet to test the internet connection of website visitors.

<?php

# From https://github.com/mathiasbynens/small/blob/master/bmp.bmp
echo hex2bin('424d1e000000000000001a0000000c00000001000100010018000000ff00');

$chunk = 1000;
for ($i = 0; $i < 1000000; $i += $chunk) {
    echo random_bytes($chunk);
}

However this file is invalid:

identify out.bmp                            
out.bmp BMP2 1x1 1x1+0+0 8-bit sRGB 1000030B 0.000u 0:00.003
identify: length and filesize do not match `out.bmp' @ warning/bmp.c/ReadBMPImage/834.

Is there a better way to send this garbage to the visitor?

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 C++ yoloV5改写遇到的问题
    • ¥20 win11修改中文用户名路径
    • ¥15 win2012磁盘空间不足,c盘正常,d盘无法写入
    • ¥15 用土力学知识进行土坡稳定性分析与挡土墙设计
    • ¥70 PlayWright在Java上连接CDP关联本地Chrome启动失败,貌似是Windows端口转发问题
    • ¥15 帮我写一个c++工程
    • ¥30 Eclipse官网打不开,官网首页进不去,显示无法访问此页面,求解决方法
    • ¥15 关于smbclient 库的使用
    • ¥15 微信小程序协议怎么写
    • ¥15 c语言怎么用printf(“\b \b”)与getch()实现黑框里写入与删除?