Index: yahoo_weather_forecast.inc
===================================================================
--- yahoo_weather_forecast.inc	(revision 4809)
+++ yahoo_weather_forecast.inc	(working copy)
@@ -14,59 +14,73 @@
  * @return void
  */
 function yahoo_weather_forecast_img_associate($code) {
-  $images = array(
-    0 => array('file' => 'overcast-fog-heavy-rain.png', 'title' => t('Tornado')),
-    1 => array('file' => 'overcast-heavy-rain.png', 'title' => t('Tropical storm')),
-    2 => array('file' => 'overcast-fog-heavy-rain.png', 'title' => t('Hurricane')),
-    3 => array('file' => 'overcast-heavy-rain.png', 'title' => t('Severe thunderstorms')),
-    4 => array('file' => 'overcast-moderate-rain.png', 'title' => t('Thunderstorms')),
-    5  => array('file' => 'overcast-light-snow.png', 'title' => t('Mixed rain ad snow')),
-    6 => array('file' => 'overcast-light-rain.png', 'title' => t('Mixed rain ad sleet')),
-    7 => array('file' => 'overcast-light-snow.png', 'title' => t('Mixed snow and sleet')),
-    8 => array('file' => 'broken-light-rain.png', 'title' => t('Freezing drizzle')),
-    9 => array('file' => 'broken-light-rain.png', 'title' => t('Drizzle')),
-    10 => array('file' => 'clear-heavy-rain.png', 'title' => t('Freezing raing')),
-    11 => array('file' => 'overcast-fog-light-rain.png', 'title' => t('Showers')),
-    12 => array('file' => 'overcast-fog-light-rain.png', 'title' => t('Showers')),
-    13 => array('file' => 'overcast-fog-heavy-snow.png', 'title' => t('Snow flurries')),
-    14 => array('file' => 'few-heavy-snow.png', 'title' => t('Light snow showers')),
-    15 => array('file' => 'scattered-light-snow.png', 'title' => t('Blowing snow')),
-    16 => array('file' => 'overcast-heavy-snow.png', 'title' => t('Snow')),
-    17 => array('file' => 'overcast-heavy-rain.png', 'title' => t('Hail')),
-    18 => array('file' => 'overcast-light-rain.png', 'title' => t('Sleet')),
-    19 => array('file' => 'clear-fog.png', 'title' => t('Dust')),
-    20 => array('file' => 'overcast-fog.png', 'title' => t('Foggy')),
-    21 => array('file' => 'overcast-fog.png', 'title' => t('Haze')),
-    22 => array('file' => 'overcast-fog.png', 'title' => t('Smoky')),
-    23 => array('file' => 'broken-fog-light-rain.png', 'title' => t('Blustery')),
-    24 => array('file' => 'few.png', 'title' => t('Windy')),
-    25 => array('file' => 'overcast.png', 'title' => t('Cold')),
-    26 => array('file' => 'broken.png', 'title' => t('Cloudy')),
-    27 => array('file' => 'night-overcast.png', 'title' => t('Mostly cloudy (night)')),
-    28 => array('file' => 'day-overcast.png', 'title' => t('Mostly cloudy (day)')),
-    29 => array('file' => 'night-few.png', 'title' => t('Partly cloudy (night)')),
-    30 => array('file' => 'day-few.png', 'title' => t('Partly cloudy (day)')),
-    31 => array('file' => 'night-clear.png', 'title' => t('Clear (night)')),
-    32 => array('file' => 'day-clear.png', 'title' => t('Sunny')),
-    33 => array('file' => 'night-clear.png', 'title' => t('Fair (night)')),
-    34 => array('file' => 'day-clear.png', 'title' => t('Fair (day)')),
-    35 => array('file' => 'overcast-moderate-rain.png', 'title' => t('Mixed rain and hail')),
-    36 => array('file' => 'clear.png', 'title' => t('Hot')),
-    37 => array('file' => 'clear-heavy-rain.png', 'title' => t('Isolated thunderstorms')),
-    38 => array('file' => 'clear-light-rain.png', 'title' => t('Scattered thunderstorms')),
-    39 => array('file' => 'clear-light-rain.png', 'title' => t('Scattered thunderstroms')),
-    40 => array('file' => 'clear-moderate-rain.png', 'title' => t('Scattered showers')),
-    41 => array('file' => 'overcast-heavy-snow.png', 'title' => t('Heavy snow')),
-    42 => array('file' => 'clear-heavy-snow.png', 'title' => t('Scattered snow showers')),
-    43 => array('file' => 'overcast-heavy-snow.png', 'title' => t('Heavy snow')),
-    44 => array('file' => 'few.png', 'title' => t('Partly cloudy')),
-    45 => array('file' => 'overcast-light-rain.png', 'title' => t('Thundershowers')),
-    46 => array('file' => 'clear-light-snow.png', 'title' => t('Snow showers')),
-    47 => array('file' => 'clear-moderate-rain.png', 'title' => t('Isolated thundershowers')),
-    3200 => array('file' => 'nodata.png', 'title' => t('Not available')),
+  static $images;
 
-  );
+  if (!isset($images)) {
+    $default = array(
+      0 => array('file' => 'overcast-fog-heavy-rain', 'title' => t('Tornado')),
+      1 => array('file' => 'overcast-heavy-rain', 'title' => t('Tropical storm')),
+      2 => array('file' => 'overcast-fog-heavy-rain', 'title' => t('Hurricane')),
+      3 => array('file' => 'overcast-heavy-rain', 'title' => t('Severe thunderstorms')),
+      4 => array('file' => 'overcast-moderate-rain', 'title' => t('Thunderstorms')),
+      5 => array('file' => 'overcast-light-snow', 'title' => t('Mixed rain and snow')),
+      6 => array('file' => 'overcast-light-rain', 'title' => t('Mixed rain and sleet')),
+      7 => array('file' => 'overcast-light-snow', 'title' => t('Mixed snow and sleet')),
+      8 => array('file' => 'broken-light-rain', 'title' => t('Freezing drizzle')),
+      9 => array('file' => 'broken-light-rain', 'title' => t('Drizzle')),
+      10 => array('file' => 'clear-heavy-rain', 'title' => t('Freezing rain')),
+      11 => array('file' => 'overcast-fog-light-rain', 'title' => t('Showers')),
+      12 => array('file' => 'overcast-fog-light-rain', 'title' => t('Showers')),
+      13 => array('file' => 'overcast-fog-heavy-snow', 'title' => t('Snow flurries')),
+      14 => array('file' => 'few-heavy-snow', 'title' => t('Light snow showers')),
+      15 => array('file' => 'scattered-light-snow', 'title' => t('Blowing snow')),
+      16 => array('file' => 'overcast-heavy-snow', 'title' => t('Snow')),
+      17 => array('file' => 'overcast-heavy-rain', 'title' => t('Hail')),
+      18 => array('file' => 'overcast-light-rain', 'title' => t('Sleet')),
+      19 => array('file' => 'clear-fog', 'title' => t('Dust')),
+      20 => array('file' => 'overcast-fog', 'title' => t('Foggy')),
+      21 => array('file' => 'overcast-fog', 'title' => t('Haze')),
+      22 => array('file' => 'overcast-fog', 'title' => t('Smoky')),
+      23 => array('file' => 'broken-fog-light-rain', 'title' => t('Blustery')),
+      24 => array('file' => 'few', 'title' => t('Windy')),
+      25 => array('file' => 'overcast', 'title' => t('Cold')),
+      26 => array('file' => 'broken', 'title' => t('Cloudy')),
+      27 => array('file' => 'night-overcast', 'title' => t('Mostly cloudy (night)')),
+      28 => array('file' => 'day-overcast', 'title' => t('Mostly cloudy (day)')),
+      29 => array('file' => 'night-few', 'title' => t('Partly cloudy (night)')),
+      30 => array('file' => 'day-few', 'title' => t('Partly cloudy (day)')),
+      31 => array('file' => 'night-clear', 'title' => t('Clear (night)')),
+      32 => array('file' => 'day-clear', 'title' => t('Sunny')),
+      33 => array('file' => 'night-clear', 'title' => t('Fair (night)')),
+      34 => array('file' => 'day-clear', 'title' => t('Fair (day)')),
+      35 => array('file' => 'overcast-moderate-rain', 'title' => t('Mixed rain and hail')),
+      36 => array('file' => 'clear', 'title' => t('Hot')),
+      37 => array('file' => 'clear-heavy-rain', 'title' => t('Isolated thunderstorms')),
+      38 => array('file' => 'clear-light-rain', 'title' => t('Scattered thunderstorms')),
+      39 => array('file' => 'clear-light-rain', 'title' => t('Scattered thunderstroms')),
+      40 => array('file' => 'clear-moderate-rain', 'title' => t('Scattered showers')),
+      41 => array('file' => 'overcast-heavy-snow', 'title' => t('Heavy snow')),
+      42 => array('file' => 'clear-heavy-snow', 'title' => t('Scattered snow showers')),
+      43 => array('file' => 'overcast-heavy-snow', 'title' => t('Heavy snow')),
+      44 => array('file' => 'few', 'title' => t('Partly cloudy')),
+      45 => array('file' => 'overcast-light-rain', 'title' => t('Thundershowers')),
+      46 => array('file' => 'clear-light-snow', 'title' => t('Snow showers')),
+      47 => array('file' => 'clear-moderate-rain', 'title' => t('Isolated thundershowers')),
+      3200 => array('file' => 'nodata', 'title' => t('Not available')),
+    );
 
+    $custom_files = variable_get('yahoo_weather_forecast_img_associate', array());
+    $default_ext = variable_get('yahoo_weather_forecast_images_extension', 'png');
+
+    foreach ($default as $key => $info) {
+      $images[$key] = isset($custom_files[$key]) ? array('file' => $custom_files[$key]) + $info : $info;
+      $pathinfo = pathinfo($images[$key]['file']);
+      if (empty($info['extension'])) {
+        $images[$key]['file'] .= ".$default_ext";
+      }
+    }
+  }
+
   return $images[$code];
 }
 
Index: yahoo_weather_forecast.module
===================================================================
--- yahoo_weather_forecast.module	(revision 4809)
+++ yahoo_weather_forecast.module	(working copy)
@@ -432,14 +432,9 @@
   $vars['daylight'] = $daylight;
 
   if ($show_options['current']) {
-    $img = yahoo_weather_forecast_img_associate($weather_info['data']['condition']['code']);
-
-    if (!(($weather_info['data']['condition']['code'] >= 27 && $weather_info['data']['condition']['code'] <= 34) || $weather_info['data']['condition']['code'] == 3200)) {
-      $prefix = "$daylight-";
-    }
-
-    $src = drupal_get_path('module', 'yahoo_weather_forecast') .'/images/'. $prefix . $img['file'];
-    $vars['current_image'] = theme('image', $src, '', $img['title'], $img['title']);
+    $status = yahoo_weather_forecast_status_info($weather_info['data']['condition']['code'], $daylight);
+    $vars['current_image'] = theme('image', $status['filepath'], $status['title'], $status['title']);
+    $vars['current_status'] = $status;
   }
 
   if ($show_options['temperature']) {
@@ -487,16 +482,10 @@
   $vars['forecasts'] = array();
   if ($show_options['forecast']) {
     foreach ($weather_info['data']['forecasts'] as $key => $value) {
-      $img = yahoo_weather_forecast_img_associate($value['code']);
-      $prefix = '';
-      if (!(($value['code'] >= 27 && $value['code'] <= 34) || $value['code'] == 3200)) {
-        $prefix = "$daylight-";
-      }
+      $status = yahoo_weather_forecast_status_info($value['code'], $daylight);
+      $vars['forecasts'][$key]['image'] = theme('image', $status['filepath'], $status['title'], $status['title']);
+      $vars['forecasts'][$key]['status'] = $status;
 
-      $src = drupal_get_path('module', 'yahoo_weather_forecast') . "/images/$prefix". $img['file'];
-      $image = theme('image', $src, $img['title'], $img['title']);
-      $vars['forecasts'][$key]['image'] = $image;
-
       if ($show_options['forecast_description']) {
         $vars['forecasts'][$key]['text'] = $value['text'];
         $vars['forecasts'][$key]['label'] = (($key == 0) ? t('Today') : t('Tomorrow'));
@@ -509,6 +498,27 @@
 }
 
 /**
+ * Return the image information related to the given code and daylight.
+ *
+ * @param int $code
+ * @param string $daylight
+ * @access public
+ * @return array
+ */
+function yahoo_weather_forecast_status_info($code, $daylight) {
+  $status = yahoo_weather_forecast_img_associate($code);
+  $prefix = '';
+  if (!(($code >= 27 && $code <= 34) || $code == 3200)) {
+    $prefix = "$daylight-";
+  }
+  $default = drupal_get_path('module', 'yahoo_weather_forecast') .'/images';
+  $status['filepath'] = variable_get('yahoo_weather_forecast_images_path', $default) .'/'. $prefix . $status['file'];
+  $status['code'] = $code;
+  $status['daylight'] = $daylight;
+  return $status;
+}
+
+/**
  * Get weather info from Yahoo weather API.
  *
  * @access protected
