Changeset 9283 for temp


Ignore:
Timestamp:
2006/11/28 11:05:08 (20 years ago)
Author:
kakinaka
Message:

blank

Location:
temp/trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • temp/trunk/data/class/SC_Image.php

    r9267 r9283  
    8181        // °ì°Õ¤ÊID¤ò¼èÆÀ¤¹¤ë¡£ 
    8282        $uniqname = date("mdHi") . "_" . uniqid(""); 
    83          
     83 
    8484        // ¥Õ¥¡¥¤¥ë̾¡¢ÊݸÀèÀßÄê 
    8585        $filename = $uniqname . "." . $extension; 
  • temp/trunk/data/lib/gdthumb.php

    r9276 r9283  
    7272    * integer $height 
    7373    */ 
    74     function Main($path, $width, $height, $dst_file) { 
     74    function Main($path, $width, $height, $dst_file, $header = false) { 
    7575         
    7676        if(!isset($path)) { 
     
    126126                    $dst_im = $imagecreate($re_size[0], $re_size[1]); 
    127127                     
    128 //                  $transparent = imagecolortransparent($src_im); 
    129 //                  $colorstotal = imagecolorstotal ($src_im); 
     128                    $transparent = imagecolortransparent($src_im); 
     129                    $colorstotal = imagecolorstotal ($src_im); 
    130130                     
    131131                    $dst_im = imagecreate($re_size[0], $re_size[1]); 
     
    138138 
    139139                    if(function_exists("imagegif")) { 
    140                         $dst_file = $dst_file . ".gif"; 
    141                         imagegif($dst_im, $dst_file); 
     140                         
     141                        // ²èÁü½ÐÎÏ 
     142                        if($header){ 
     143                            header("Content-Type: image/gif"); 
     144                            imagegif($dst_im); 
     145                            return ""; 
     146                        }else{ 
     147                            $dst_file = $dst_file . ".gif"; 
     148                            imagegif($dst_im, $dst_file); 
     149                        } 
     150                         
    142151                        imagedestroy($src_im); 
    143152                        imagedestroy($dst_im); 
    144153                    } else { 
    145                         $dst_file = $dst_file . ".png";                      
    146                         imagepng($dst_im, $dst_file); 
     154                        // ²èÁü½ÐÎÏ 
     155                        if($header){ 
     156                            header("Content-Type: image/png"); 
     157                            imagepng($dst_im); 
     158                            return ""; 
     159                        }else{ 
     160                            $dst_file = $dst_file . ".png";                      
     161                            imagepng($dst_im, $dst_file); 
     162                        } 
    147163                        imagedestroy($src_im); 
    148164                        imagedestroy($dst_im); 
     
    159175                    imagestring($dst_im, 5, 10, 10, "GIF $size[0]x$size[1]", $red); 
    160176                    imageRectangle ($dst_im, 0, 0, ($re_size[0]-1), ($re_size[1]-1), $black); 
    161                     $dst_file = $dst_file . ".png"; 
    162                     imagepng($dst_im, $dst_file); 
     177                     
     178                    // ²èÁü½ÐÎÏ 
     179                    if($header){ 
     180                        header("Content-Type: image/png"); 
     181                        imagepng($dst_im); 
     182                        return ""; 
     183                    }else{ 
     184                        $dst_file = $dst_file . ".png"; 
     185                        imagepng($dst_im, $dst_file); 
     186                    } 
    163187                    imagedestroy($src_im); 
    164188                    imagedestroy($dst_im); 
     
    173197                $imageresize( $dst_im, $src_im, 0, 0, 0, 0, $re_size[0], $re_size[1], $size[0], $size[1]); 
    174198                 
    175                 $dst_file = $dst_file . ".jpg"; 
    176                 imageJpeg($dst_im, $dst_file); 
     199                // ²èÁü½ÐÎÏ 
     200                if($header){ 
     201                    header("Content-Type: image/jpeg"); 
     202                    imageJpeg($dst_im); 
     203                    return ""; 
     204                }else{ 
     205                    $dst_file = $dst_file . ".jpg"; 
     206                    imageJpeg($dst_im, $dst_file); 
     207                } 
     208                 
    177209                imagedestroy($src_im); 
    178210                imagedestroy($dst_im); 
     
    196228                    imagecopyresized($dst_im,$src_im, 0, 0, 0, 0, $re_size[0], $re_size[1], $size[0], $size[1]); 
    197229                    imagetruecolortopalette($dst_im, false, imagecolorstotal($src_im)); 
    198                 }                
    199              
    200                 $dst_file = $dst_file . ".png"; 
    201                 imagepng($dst_im, $dst_file); 
     230                } 
     231                 
     232                // ²èÁü½ÐÎÏ 
     233                if($header){ 
     234                    header("Content-Type: image/png"); 
     235                    imagepng($dst_im); 
     236                    return ""; 
     237                }else{ 
     238                    $dst_file = $dst_file . ".png"; 
     239                    imagepng($dst_im, $dst_file); 
     240                } 
    202241                imagedestroy($src_im); 
    203242                imagedestroy($dst_im); 
  • temp/trunk/html/resize_image.php

    r9207 r9283  
    22 
    33$include_dir = realpath(dirname( __FILE__)); 
    4 require_once($include_dir . "/../data/class/SC_Image.php"); 
     4require_once($include_dir . "/../data/lib/gdthumb.php"); 
    55require_once($include_dir . "/../data/conf/conf.php");   
    66 
    7 $objImage = new SC_Image(IMAGE_TEMP_DIR); 
     7$objThumb = new gdthumb(); 
    88 
    99$file = $_GET["image"]; 
    1010if(file_exists($file)){ 
    11     $objImage->saveResizeImage($file, $_GET["width"], $_GET["height"], true); 
     11    $objThumb->Main($file, $_GET["width"], $_GET["height"], "", true); 
     12//  $objImage->saveResizeImage($file, $_GET["width"], $_GET["height"], true); 
    1213}else{ 
    13     $objImage->saveResizeImage(NO_IMAGE_DIR, $_GET["width"], $_GET["height"], true); 
     14//  $objImage->saveResizeImage(NO_IMAGE_DIR, $_GET["width"], $_GET["height"], true); 
     15    $objThumb->Main(NO_IMAGE_DIR, $_GET["width"], $_GET["height"], "", true); 
    1416} 
    1517 
Note: See TracChangeset for help on using the changeset viewer.