Tak wygląda kod
<? include('db.php'); { // Create a destination // Get contents from original spot $im = imagecreatefromjpeg("images/mapa_new2018a1.jpg"); $white = imagecolorallocate($im, 255, 255, 255); $red = imagecolorallocate($im, 255, 0, 0); // Save to disk in the new spot and name $dzien["Monday"] = "Poniedziałek"; $dzien["Tuesday"] = "Wtorek"; $dzien["Wednesday"] = "Środa"; $dzien["Thursday"] = "Czwartek"; $dzien["Friday"] = "Piątek"; $dzien["Saturday"] = "Sobota"; $dzien["Sunday"] = "Niedziela"; $result = $mysqli->query("SELECT * FROM dane WHERE id_miasto =1 ORDER BY id DESC LIMIT 1"); while ( $row = mysqli_fetch_array($result) ) { $text = 'Temperatura powietrza na wysokości 2m. '.$row['czas'].' '.$row['godzina'].''; $tempmax = ''.$row['temp'].'şC'; } $result = $mysqli->query("SELECT * FROM dane WHERE id_miasto =19 ORDER BY id DESC LIMIT 1"); while ( $row = mysqli_fetch_array($result) ) { $tempmax1 = ''.$row['temp'].'şC'; } // Replace path by your own font path $font = 'arial.ttf'; imagettftext($im, 34, 0, 14, 69, $white, $font, $text); imagettftext($im, 33, 0, 986, 227, $red, $font, $tempmax); //darłowo imagettftext($im, 33, 0, 193, 891, $red, $font, $tempmax1); //szczecin imagejpeg($im,$dest, 100); // Destroy image imagedestroy($im); } ?>
Włączone funkcje GD na serwerze
array(12) { ["GD Version"]=> string(26) "bundled (2.1.0 compatible)" ["FreeType Support"]=> bool(true) ["FreeType Linkage"]=> string(13) "with freetype" ["GIF Read Support"]=> bool(true) ["GIF Create Support"]=> bool(true) ["JPEG Support"]=> bool(true) ["PNG Support"]=> bool(true) ["WBMP Support"]=> bool(true) ["XPM Support"]=> bool(true) ["XBM Support"]=> bool(true) ["WebP Support"]=> bool(false) ["JIS-mapped Japanese Font Support"]=> bool(false) }