Changeset 1829 for sandbox/filemanager/inc/upload.php
- Timestamp:
- 12/15/09 09:13:57 (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
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.