owfont openweathermap glyphs mapping for images made with gd lib etc.

Started on the old forum in January 2018 · view the original in the archive · old links redirect here

No replies · 42 views · started 8 years ago · 1 min read

GumSlone Administrator Principal · 1,690 posts #1

code snippet for usage of owfont openweathermap glyphs in images made with php gd lib epd.png

$black = imagecolorallocate($im, 0, 0, 0);
$weather_icons = './fonts/owfont-regular.ttf';
$icons = array(
200=>"EB28", 201=>"EB29", 202=>"EB2A", 210=>"EB32", 211=>"EB33", 212=>"EB34", 221=>"EB3D", 230=>"EB46", 231=>"EB47", 232=>"EB48",
300=>"EB8C", 301=>"EB8D", 302=>"EB8E", 310=>"EB96", 311=>"EB97", 312=>"EB98", 313=>"EB99", 314=>"EB9A", 321=>"EBA1",
500=>"EC54", 501=>"EC55", 502=>"EC56", 503=>"EC57", 504=>"EC58", 511=>"EC5F", 520=>"EC68", 521=>"EC69", 522=>"EC6A", 531=>"EC73",
600=>"ECB8", 601=>"ECB9", 602=>"ECBA", 611=>"ECC3", 612=>"ECC4", 615=>"ECC7", 616=>"ECC8", 620=>"ECCC", 621=>"ECCD", 622=>"ECCE",
701=>"ED1D", 711=>"ED27", 721=>"ED31", 731=>"ED3B", 741=>"ED45", 751=>"ED4F", 761=>"ED59", 762=>"ED5A", 771=>"ED63", 781=>"ED6D",  
800=>"ED80",
'800-d'=>"ED80",
951=>"ED80",
'951-d'=>"ED80",
'800-n'=>"F168",
'951-n'=>"F168",
801=>"ED81",
'801-d'=>"ED81",
'801-n'=>"F169",
802=>"ED82",
'802-d'=>"ED82",
'802-n'=>"F16A",
803=>"ED83", 804=>"ED84",
900=>"EDE4", 901=>"EDE5", 902=>"EDE6", 903=>"EDE7", 904=>"EDE8", 905=>"EDE9", 906=>"EDEA",
950=>"EE16", 952=>"EE18", 953=>"EE19", 954=>"EE1A", 955=>"EE1B", 956=>"EE1C", 957=>"EE1D", 958=>"EE1E", 959=>"EE1F", 960=>"EE20", 961=>"EE21", 962=>"EE22");

$now = date('U'); //get current time

if($now > $forecast_arr['sys']['sunrise'] and $now < $forecast_arr['sys']['sunset']){
    $suffix = '-d';
}else{
    $suffix = '-n';
}

ImageTTFText ($im, 40, 0, 5, 120, $black, $weather_icons, json_decode('"&#x'.$icons[$forecast_arr['weather'][0]['id'].$suffix].';"'));

Advertise your mobile site for FREE with AdTwirl

External image (may be gone)

Write your reply now; next you create a free account (or sign in) and it is posted right away. Sign in to reply.

Keyboard shortcuts

g f
Go to forums
g h
Go to your feed
g m
Go to messages
r
Reply (in a topic)
/
Search
j
Next post
k
Previous post
?
This list
Ctrl/⌘ + Enter
Send what you are writing
Ctrl/⌘ + B / I
Bold / italic while writing
Esc
Close