function _weather_get_image in Weather 5.6
Same name and namespace in other branches
- 5 weather.module \_weather_get_image()
- 6.5 weather.module \_weather_get_image()
1 call to _weather_get_image()
- theme_weather in ./weather.module
- Custom theme function for the weather block output
File
- ./weather.module, line 411
- Display <acronym title="METeorological Aerodrome Report">METAR</acronym>
weather data from anywhere in the world
Code
function _weather_get_image($metar) {
if (!isset($metar['condition_text'])) {
$name = 'nodata';
}
else {
if ($metar['condition_text'] == 'no-significant-clouds') {
$metar['condition_text'] = 'few';
}
$name = $metar['daytime']['condition'] . '-' . $metar['condition_text'];
if (isset($metar['phenomena']['rain'])) {
$rain = $metar['phenomena']['rain'];
}
else {
if (isset($metar['phenomena']['drizzle'])) {
$rain = $metar['phenomena']['drizzle'];
}
else {
if (isset($metar['phenomena']['snow'])) {
$snow = $metar['phenomena']['snow'];
}
}
}
if (isset($rain)) {
if (isset($rain['#light'])) {
$name .= '-light-rain';
}
else {
if (isset($rain['#heavy'])) {
$name .= '-heavy-rain';
}
else {
$name .= '-moderate-rain';
}
}
}
if (isset($snow)) {
if (isset($snow['#light'])) {
$name .= '-light-snow';
}
else {
if (isset($snow['#heavy'])) {
$name .= '-heavy-snow';
}
else {
$name .= '-moderate-snow';
}
}
}
}
$image['filename'] = base_path() . drupal_get_path('module', 'weather') . '/images/' . $name . '.png';
$size = getimagesize(drupal_get_path('module', 'weather') . '/images/' . $name . '.png');
$image['size'] = $size[3];
return $image;
}