如何通过图像发送身份验证标头?

I'm completely new to php but managed to find a script that will produce the HTTP/1.0 401 Unauthorized message box

This is the message box:

I've heard and seen that you can make this message box be sent through an image. How do i go about doing that?

When done, the steps should be:

I post image.jpg The authentication message shows up

I know it involves me having a website (example.com). Then on the website i have a folder (example.com/folder) and in that folder i have the image (example.com/folder/image.jpg). What php script do i put in the folder that will result in the image generating the authentication message?

As said before in comments, it has nothing to do with PHP.

The button in your example just set the image URL. But that URL is protected by HTTP Basic Authentication.

To do this just create 2 files in the image folder : .htaccess and .htpasswd

And add HTML and Javascript code like the one on the website :

<img src="" id="downloadImg" alt=""/>
<input type="button" value="Display Image" id="displayImage" onclick="document.getElementById('downloadImg').src='/protected-folder/image.jpg';"/>