Changeset 1829 for sandbox/filemanager/inc
- Timestamp:
- 12/15/09 09:13:57 (15 years ago)
- Location:
- sandbox/filemanager/inc
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
sandbox/filemanager/inc/class.vfs_functions.inc.php
r1704 r1829 25 25 'editComment'=> True, 26 26 'rename'=>True, 27 'delete'=>True 27 'delete'=>True, 28 'summary' => True 28 29 ); 29 30 … … 214 215 215 216 } 216 function download()217 function summary() 217 218 { 218 219 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); 223 224 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 )); 227 229 $GLOBALS['phpgw']->common->phpgw_exit(); 228 230 } 229 231 } 232 230 233 function delete(){ 231 234 foreach($this->fileman as $filename) -
sandbox/filemanager/inc/upload.php
r1804 r1829 20 20 $path = base64_decode($_POST['path']); 21 21 $show_upload_boxes = count($_FILES['upload_file']['name'])-1; 22 23 24 function 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 } 22 56 23 57 /* Its much faster test all files only one time */ … … 97 131 else 98 132 { 99 133 100 134 if ($bo->vfs->cp(array( 101 135 'from'=> $_FILES['upload_file']['tmp_name'][$i], … … 103 137 'relatives' => array(RELATIVE_NONE|VFS_REAL, RELATIVE_ALL) 104 138 ))) 139 { 105 140 $bo->vfs->set_attributes(array( 106 141 'string'=> $_FILES['upload_file']['name'][$i], … … 111 146 ) 112 147 )); 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 } 113 158 else{ 114 159 $return[] = lang('Error:').lang('Your quota has exceeded the limit'); … … 129 174 'relatives' => array(RELATIVE_ALL), 130 175 'attributes'=> array( 131 132 176 'mime_type' => $_FILES['upload_file']['type'][$i], 177 'comment' => stripslashes($_POST['upload_comment'][$i]) 133 178 ) 134 179 ));
Note: See TracChangeset
for help on using the changeset viewer.