NIWPI/Info/image.php

33 lines
1.1 KiB
PHP
Raw Normal View History

2018-12-17 14:55:52 +01:00
<?php
include "uinfo.class.php";
2020-06-15 14:51:17 +02:00
#array_key_exists('HTTP_USER_AGENT', $_SERVER) && $_SERVER['HTTP_USER_AGENT'] ? $_SERVER["HTTP_USER_AGENT"] : "undefined" ;
#$user = new uInfo($_SERVER["HTTP_USER_AGENT"], $_SERVER["REMOTE_ADDR"]) ;
$userAgent = array_key_exists('HTTP_USER_AGENT', $_SERVER) && $_SERVER['HTTP_USER_AGENT'] ? $_SERVER["HTTP_USER_AGENT"] : "undefined" ;
$user = new uInfo($userAgent, $_SERVER["REMOTE_ADDR"]) ;
2018-12-17 14:55:52 +01:00
header("Content-type: image/jpeg");
$img = imagecreatefromjpeg("img/type1.jpg");
imagewritestring($img, 14, $user->host->ip);
imagewritestring($img, 12, $user->host->city);
imagewritestring($img, 12, $user->os->name . " " . $user->os->version);
imagewritestring($img, 12, $user->browser->name . " " . $user->browser->version);
imagewritestring($img, 12, 'Pays: ' . $user->host->country);
imagejpeg($img, NULL, 100);
imagedestroy($img);
function imagewritestring($img, $font_size, $string)
{
$color = imagecolorallocate($img, 180, 180, 180);
static $y = 110;
2020-06-16 21:22:16 +02:00
$y += $font_size + 14;
2018-12-17 14:55:52 +01:00
$x = 40;
imagettftext($img, $font_size, 0, $x, $y, $color, "fonts/consola.ttf", $string);
}
2020-06-15 14:51:17 +02:00