diff --git a/twitter_pull.class.inc b/twitter_pull.class.inc
index 2538b96..95cdee0 100644
--- a/twitter_pull.class.inc
+++ b/twitter_pull.class.inc
@@ -59,7 +59,7 @@ class twitter_puller {
     // if the first character is ~, then consider the key a favorites feed
     elseif ($prefix == "~") {
       $key = drupal_substr($this->twitkey, 1);
-      $url = 'http://api.twitter.com/1/favorites/'.urlencode($key).'.json?count='.$num;   
+      $url = 'http://api.twitter.com/1/favorites/'.urlencode($key).'.json?count='.$num;
     }
     // otherwise, use the key as a search term
     else {
@@ -110,7 +110,9 @@ class twitter_puller {
           $obj->username = (isset($item->retweeted_status->user) && !empty($item->retweeted_status->user->screen_name)) ? $item->retweeted_status->user->screen_name : $item->retweeted_status->from_user;
             $obj->username = check_plain($obj->username);
           $obj->userphoto = (isset($item->retweeted_status->user) && !empty($item->retweeted_status->user->profile_image_url)) ? $item->retweeted_status->user->profile_image_url : $item->retweeted_status->profile_image_url;
-            $obj->userphoto = check_plain($obj->userphoto);
+          $obj->userphoto = check_plain($obj->userphoto);
+          $obj->userphoto_https = (isset($item->user) && !empty($item->user->profile_image_url_https)) ? $item->user->profile_image_url_https : $item->profile_image_url_https;
+          $obj->userphoto_https = check_plain($obj->userphoto_https);
           $obj->text = filter_xss($item->retweeted_status->text);
           //-- Convert date to unix timestamp so themer can easily work with it.
           $obj->timestamp = strtotime($item->retweeted_status->created_at);
diff --git a/twitter_pull.module b/twitter_pull.module
index 9957d18..85a63ea 100644
--- a/twitter_pull.module
+++ b/twitter_pull.module
@@ -137,6 +137,8 @@ function twitter_pull_render($twitkey, $title = NULL, $num_items = NULL, $themek
  *     Number of tweets to retrieve from Twitter. Can't be more than 200.
  */
 function twitter_pull_retrieve($twitkey, $num_items = NULL) {
+  global $is_https;
+
   // If $num_items is not set, use the default value.
   // This value is checked more rigorously in twitter_puller->check_arguments().
   $num_items = (intval($num_items) > 0) ? intval($num_items) : twitter_pull_num_items();
@@ -172,6 +174,14 @@ function twitter_pull_retrieve($twitkey, $num_items = NULL) {
     }
   }
 
+  // If we have tweets and are viewing a secure site, we want to set the url
+  // to the userphoto to use the secure image to avoid insecure errors.
+  if (!empty($tweets) && is_array($tweets) && $is_https) {
+    foreach ($tweets as $i => $tweet) {
+      $tweets[$i]->userphoto = $tweet->userphoto_https;
+    }
+  }
+
   return $tweets;
 }
 
