Changeset 2651

Show
Ignore:
Timestamp:
06/30/08 02:26:07 (20 months ago)
Author:
takayama
Message:

Fixed BugId:80372
* Shows warning messages if GD-php was not available.

Location:
branches/release-41/php
Files:
7 modified

Legend:

Unmodified
Added
Removed
  • branches/release-41/php/lib/MTUtil.php

    r2595 r2651  
    13011301    $dest; 
    13021302    $thumb_name = $static_file_path.DIRECTORY_SEPARATOR.$image_path.DIRECTORY_SEPARATOR.$format; 
    1303     $thumb->get_thumbnail($dest, $thumb_w, $thumb_h, $scale, $thumb_name, 'png'); 
     1303    if (!$thumb->get_thumbnail($dest, $thumb_w, $thumb_h, $scale, $thumb_name, 'png')) { 
     1304        return ''; 
     1305    } 
    13041306    $basename = basename($dest); 
    13051307 
     
    13451347    $thumb_h = $height; 
    13461348    $dest; 
    1347     $thumb->get_thumbnail($dest, $thumb_w, $thumb_h, $scale, $thumb_name); 
     1349    if (!$thumb->get_thumbnail($dest, $thumb_w, $thumb_h, $scale, $thumb_name)) { 
     1350        return ''; 
     1351    } 
    13481352 
    13491353    # make url 
  • branches/release-41/php/lib/function.mtassetthumbnaillink.php

    r1174 r2651  
    2828 
    2929    list($thumb, $thumb_w, $thumb_h) = get_thumbnail_file($asset, $blog, $width, $height, $scale); 
     30    if (empty($thumb)) { 
     31        return ''; 
     32    } 
     33 
    3034    $target = ""; 
    3135    if (isset($args['new_window'])) 
  • branches/release-41/php/lib/function.mtauthoruserpic.php

    r2356 r2651  
    2626    require_once("MTUtil.php"); 
    2727    $userpic_url = userpic_url($asset[0], $blog, $author); 
     28    if (empty($userpic_url)) 
     29        return ''; 
    2830    $asset_path = asset_path($asset[0]['asset_file_path'], $blog); 
    2931    list($src_w, $src_h, $src_type, $src_attr) = getimagesize($asset_path); 
  • branches/release-41/php/lib/function.mtcommenteruserpic.php

    r1174 r2651  
    2222    require_once("MTUtil.php"); 
    2323    $userpic_url = userpic_url($asset[0], $blog, $cmntr); 
     24    if (empty($userpic_url)) 
     25        return ''; 
     26 
    2427    $asset_path = asset_path($asset[0]['asset_file_path'], $blog); 
    2528    list($src_w, $src_h, $src_type, $src_attr) = getimagesize($asset_path); 
  • branches/release-41/php/lib/function.mtentryauthoruserpic.php

    r1174 r2651  
    2323    require_once("MTUtil.php"); 
    2424    $userpic_url = userpic_url($asset[0], $blog, $author); 
     25    if (empty($userpic_url)) 
     26        return ''; 
    2527    $asset_path = asset_path($asset[0]['asset_file_path'], $blog); 
    2628    list($src_w, $src_h, $src_type, $src_attr) = getimagesize($asset_path); 
  • branches/release-41/php/lib/thumbnail_lib.php

    r2580 r2651  
    1616    function Thumbnail ($src) { 
    1717        $this->src_file = $src; 
     18    } 
     19 
     20    # Can we use function of GD? 
     21    function is_available () { 
     22        return extension_loaded('gd'); 
    1823    } 
    1924 
     
    9095        if (empty($this->src_file)) return false; 
    9196        if (!file_exists($this->src_file)) return false; 
     97        if (!$this->is_available()) { 
     98            global $mt; 
     99            $mt->warning_log($mt->translate('GD support has not been available. Please install GD support.')); 
     100            return false; 
     101        } 
    92102 
    93103        # Get source image information 
  • branches/release-41/php/mt.php.pre

    r2479 r2651  
    3030    var $conditional = false; 
    3131    var $log = array(); 
     32    var $warning = array(); 
    3233    var $id; 
    3334    var $request; 
     
    597598        echo $output; 
    598599 
     600        // if warnings found, show it. 
     601        if (!empty($this->warning)) { 
     602            $this->_dump($this->warning); 
     603        } 
     604 
    599605        if ($this->debugging) { 
    600606            $this->log("Queries: ".$mtdb->num_queries); 
     
    688694    } 
    689695 
    690     function log_dump() { 
     696    function _dump($dump) { 
    691697        if ($_SERVER['REMOTE_ADDR']) { 
    692698            // web view... 
    693699            echo "<div class=\"debug\" style=\"border:1px solid red; margin:0.5em; padding: 0 1em; text-align:left; background-color:#ddd; color:#000\"><pre>"; 
    694             echo implode("\n", $this->log); 
     700            echo implode("\n", $dump); 
    695701            echo "</pre></div>\n\n"; 
    696702        } else { 
    697703            // console view... 
    698704            $stderr = fopen('php://stderr', 'w');  
    699             fwrite($stderr,implode("\n", $this->log));  
    700             echo (implode("\n", $this->log));  
     705            fwrite($stderr,implode("\n", $dump));  
     706            echo (implode("\n", $dump));  
    701707            fclose($stderr); 
    702708        } 
     709    } 
     710 
     711    function log_dump() { 
     712        $this->_dump($this->log); 
    703713    } 
    704714 
     
    793803        return $out; 
    794804    } 
     805 
     806    function warning_log($str) { 
     807        $this->warning[] = $str; 
     808    } 
    795809} 
    796810