Index: branches/release-41/php/lib/function.mtcommenteruserpic.php
===================================================================
--- branches/release-41/php/lib/function.mtcommenteruserpic.php (revision 1174)
+++ branches/release-41/php/lib/function.mtcommenteruserpic.php (revision 2651)
@@ -22,4 +22,7 @@
     require_once("MTUtil.php");
     $userpic_url = userpic_url($asset[0], $blog, $cmntr);
+    if (empty($userpic_url))
+        return '';
+
     $asset_path = asset_path($asset[0]['asset_file_path'], $blog);
     list($src_w, $src_h, $src_type, $src_attr) = getimagesize($asset_path);
Index: branches/release-41/php/lib/thumbnail_lib.php
===================================================================
--- branches/release-41/php/lib/thumbnail_lib.php (revision 2580)
+++ branches/release-41/php/lib/thumbnail_lib.php (revision 2651)
@@ -16,4 +16,9 @@
     function Thumbnail ($src) {
         $this->src_file = $src;
+    }
+
+    # Can we use function of GD?
+    function is_available () {
+        return extension_loaded('gd');
     }
 
@@ -90,4 +95,9 @@
         if (empty($this->src_file)) return false;
         if (!file_exists($this->src_file)) return false;
+        if (!$this->is_available()) {
+            global $mt;
+            $mt->warning_log($mt->translate('GD support has not been available. Please install GD support.'));
+            return false;
+        }
 
         # Get source image information
Index: branches/release-41/php/lib/function.mtauthoruserpic.php
===================================================================
--- branches/release-41/php/lib/function.mtauthoruserpic.php (revision 2356)
+++ branches/release-41/php/lib/function.mtauthoruserpic.php (revision 2651)
@@ -26,4 +26,6 @@
     require_once("MTUtil.php");
     $userpic_url = userpic_url($asset[0], $blog, $author);
+    if (empty($userpic_url))
+        return '';
     $asset_path = asset_path($asset[0]['asset_file_path'], $blog);
     list($src_w, $src_h, $src_type, $src_attr) = getimagesize($asset_path);
Index: branches/release-41/php/lib/function.mtassetthumbnaillink.php
===================================================================
--- branches/release-41/php/lib/function.mtassetthumbnaillink.php (revision 1174)
+++ branches/release-41/php/lib/function.mtassetthumbnaillink.php (revision 2651)
@@ -28,4 +28,8 @@
 
     list($thumb, $thumb_w, $thumb_h) = get_thumbnail_file($asset, $blog, $width, $height, $scale);
+    if (empty($thumb)) {
+        return '';
+    }
+
     $target = "";
     if (isset($args['new_window']))
Index: branches/release-41/php/lib/function.mtentryauthoruserpic.php
===================================================================
--- branches/release-41/php/lib/function.mtentryauthoruserpic.php (revision 1174)
+++ branches/release-41/php/lib/function.mtentryauthoruserpic.php (revision 2651)
@@ -23,4 +23,6 @@
     require_once("MTUtil.php");
     $userpic_url = userpic_url($asset[0], $blog, $author);
+    if (empty($userpic_url))
+        return '';
     $asset_path = asset_path($asset[0]['asset_file_path'], $blog);
     list($src_w, $src_h, $src_type, $src_attr) = getimagesize($asset_path);
Index: branches/release-41/php/lib/MTUtil.php
===================================================================
--- branches/release-41/php/lib/MTUtil.php (revision 2595)
+++ branches/release-41/php/lib/MTUtil.php (revision 2651)
@@ -1301,5 +1301,7 @@
     $dest;
     $thumb_name = $static_file_path.DIRECTORY_SEPARATOR.$image_path.DIRECTORY_SEPARATOR.$format;
-    $thumb->get_thumbnail($dest, $thumb_w, $thumb_h, $scale, $thumb_name, 'png');
+    if (!$thumb->get_thumbnail($dest, $thumb_w, $thumb_h, $scale, $thumb_name, 'png')) {
+        return '';
+    }
     $basename = basename($dest);
 
@@ -1345,5 +1347,7 @@
     $thumb_h = $height;
     $dest;
-    $thumb->get_thumbnail($dest, $thumb_w, $thumb_h, $scale, $thumb_name);
+    if (!$thumb->get_thumbnail($dest, $thumb_w, $thumb_h, $scale, $thumb_name)) {
+        return '';
+    }
 
     # make url
Index: branches/release-41/php/mt.php.pre
===================================================================
--- branches/release-41/php/mt.php.pre (revision 2479)
+++ branches/release-41/php/mt.php.pre (revision 2651)
@@ -30,4 +30,5 @@
     var $conditional = false;
     var $log = array();
+    var $warning = array();
     var $id;
     var $request;
@@ -597,4 +598,9 @@
         echo $output;
 
+        // if warnings found, show it.
+        if (!empty($this->warning)) {
+            $this->_dump($this->warning);
+        }
+
         if ($this->debugging) {
             $this->log("Queries: ".$mtdb->num_queries);
@@ -688,17 +694,21 @@
     }
 
-    function log_dump() {
+    function _dump($dump) {
         if ($_SERVER['REMOTE_ADDR']) {
             // web view...
             echo "<div class=\"debug\" style=\"border:1px solid red; margin:0.5em; padding: 0 1em; text-align:left; background-color:#ddd; color:#000\"><pre>";
-            echo implode("\n", $this->log);
+            echo implode("\n", $dump);
             echo "</pre></div>\n\n";
         } else {
             // console view...
             $stderr = fopen('php://stderr', 'w'); 
-            fwrite($stderr,implode("\n", $this->log)); 
-            echo (implode("\n", $this->log)); 
+            fwrite($stderr,implode("\n", $dump)); 
+            echo (implode("\n", $dump)); 
             fclose($stderr);
         }
+    }
+
+    function log_dump() {
+        $this->_dump($this->log);
     }
 
@@ -793,4 +803,8 @@
         return $out;
     }
+
+    function warning_log($str) {
+        $this->warning[] = $str;
+    }
 }
 
