Souce Code of creating small image by PHP
<?php
//We can pass in 'Get' variable to make each link unique in order to track accordingly
if(isset($_GET['mail'])){
$key= htmlspecialchars($_GET['mail']);
}
//Below to line's function is to log device inforamtion and their ip address
$agent=$_SERVER['HTTP_USER_AGENT'];
$ip = $_SERVER['REMOTE_ADDR'];
//Option1:we can use a SQL database to log details
$conn = new mysqli($servername, $username, $password, $dbname);
if ($conn->connect_error){
die("Failed: " . $conn->connect_error);
}
//Option2:we can also use a txt file to log data alternatively
$myfile = fopen("feed.txt", "a+") or die("Unable to open file!");
fwrite($myfile, $rich);
fclose($myfile);
//After the log of data, we can use the code from part1 to display image afterward
?>
<?php
$im = imagecreatetruecolor(120, 20);
$text_color = imagecolorallocate($im, 233, 14, 91);
imagestring($im, 1, 5, 5, 'A Simple Text String', $text_color);
header('Content-Type: image/jpeg');
imagejpeg($im);
imagedestroy($im);
?>