Ignore:
Timestamp:
12/15/09 09:13:57 (15 years ago)
Author:
amuller
Message:

Ticket #597 - Melhoria do FM, miniatura thumbnail de imagens

Location:
sandbox/filemanager/inc
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • sandbox/filemanager/inc/class.vfs_functions.inc.php

    r1704 r1829  
    2525                        'editComment'=> True, 
    2626                        'rename'=>True, 
    27                         'delete'=>True 
     27                        'delete'=>True, 
     28                        'summary' => True 
    2829                ); 
    2930 
     
    214215 
    215216                } 
    216                 function download() 
     217                function summary() 
    217218                { 
    218219                        if($this->file) 
    219                         { 
    220                                 //$GLOBALS['phpgw']->browser->content_header($this->file); 
    221                                 header ("Content-Type: application/octet-stream"); 
    222                                 header("Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0"); 
     220                        {        
     221                                header('Content-Type: image/gif'); 
     222                                $expires = 60*60*24*15; /* 15 days */ 
     223                                header("Cache-Control: maxage=".$expires); 
    223224                                header("Pragma: public"); 
    224                                 header("Expires: 0"); 
    225                                 header ("Content-Disposition: attachment; filename=\"". addslashes($this->file)."\""); 
    226                                 echo $this->bo->vfs->read(array('string' => $this->file)); 
     225                                header("Expires: ".gmdate('D, d M Y H:i:s', time()+$expires)); 
     226                                echo $this->bo->vfs->summary(array('path' => $this->path, 
     227                                        'string' => $this->file 
     228                                )); 
    227229                                $GLOBALS['phpgw']->common->phpgw_exit(); 
    228230                        } 
    229231                } 
     232         
    230233                function delete(){ 
    231234                        foreach($this->fileman as $filename) 
  • sandbox/filemanager/inc/upload.php

    r1804 r1829  
    2020$path = base64_decode($_POST['path']); 
    2121$show_upload_boxes = count($_FILES['upload_file']['name'])-1; 
     22 
     23 
     24function create_summaryImage($file){ 
     25        list($width, $height,$image_type) = getimagesize($file); 
     26        switch($image_type) 
     27        { 
     28        case 1: 
     29                $image_big = imagecreatefromgif($file); 
     30                break; 
     31        case 2: 
     32                $image_big = imagecreatefromjpeg($file); 
     33                break; 
     34        case 3: 
     35                $image_big = imagecreatefrompng($file); 
     36                break; 
     37        default: 
     38                return; 
     39        } 
     40        $max_resolution = 48; 
     41        if ($width > $height){ 
     42                $new_width = $max_resolution; 
     43                $new_height = $height*($new_width/$width); 
     44        } 
     45        else { 
     46                $new_height = $max_resolution; 
     47                $new_width = $width*($new_height/$height); 
     48        } 
     49        $image_new = imagecreatetruecolor($new_width, $new_height); 
     50        imagecopyresampled($image_new, $image_big, 0, 0, 0, 0, $new_width, $new_height, $width, $height); 
     51        ob_start(); 
     52        imagegif($image_new); 
     53        $content = ob_get_clean(); 
     54        return $content; 
     55} 
    2256 
    2357/* Its much faster test all files only one time */ 
     
    97131                        else 
    98132                        { 
    99  
     133                 
    100134                                if ($bo->vfs->cp(array( 
    101135                                        'from'=> $_FILES['upload_file']['tmp_name'][$i], 
     
    103137                                        'relatives'     => array(RELATIVE_NONE|VFS_REAL, RELATIVE_ALL) 
    104138                                ))) 
     139                                { 
    105140                                        $bo->vfs->set_attributes(array( 
    106141                                                'string'=> $_FILES['upload_file']['name'][$i], 
     
    111146                                        ) 
    112147                                )); 
     148                                        if (!(strpos(strtoupper($_FILES['upload_file']['type'][$i]),'IMAGE') === FALSE)) 
     149                                        { 
     150                                                $content = create_summaryImage($_FILES['upload_file']['tmp_name'][$i]); 
     151                                                $bo->vfs->set_summary(array( 
     152                                                'string'=> $_FILES['upload_file']['name'][$i], 
     153                                                'relatives' => array(RELATIVE_ALL), 
     154                                                'summary'=> $content 
     155                                        )); 
     156                                        } 
     157                                } 
    113158                                else{ 
    114159                                        $return[] = lang('Error:').lang('Your quota has exceeded the limit'); 
     
    129174                                'relatives'     => array(RELATIVE_ALL), 
    130175                                'attributes'=> array( 
    131                                         'mime_type' => $_FILES['upload_file']['type'][$i], 
    132                                         'comment' => stripslashes($_POST['upload_comment'][$i]) 
     176                                'mime_type' => $_FILES['upload_file']['type'][$i], 
     177                                'comment' => stripslashes($_POST['upload_comment'][$i]) 
    133178                                ) 
    134179                        )); 
Note: See TracChangeset for help on using the changeset viewer.