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

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

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

    code snippet for usage of owfont openweathermap glyphs in images made with php gd lib
    Click image for larger version

Name:	epd.png
Views:	50
Size:	15.1 KB
ID:	154528
    PHP Code:
    $black imagecolorallocate($im000);
    $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 ($im4005120$black$weather_iconsjson_decode('"&#x'.$icons[$forecast_arr['weather'][0]['id'].$suffix].';"')); 
    Advertise your mobile site for FREE with AdTwirl

Working...
X