Revision 1819
Added by Dietmar almost 12 years ago
upload.php | ||
---|---|---|
15 | 15 |
* |
16 | 16 |
*/ |
17 | 17 |
|
18 |
// Print admin header |
|
19 |
require('../../config.php'); |
|
20 |
include_once('resize_img.php'); |
|
21 |
include_once('parameters.php'); |
|
18 |
if(!defined('WB_URL')) |
|
19 |
{ |
|
20 |
$config_file = realpath('../../config.php'); |
|
21 |
if(file_exists($config_file) && !defined('WB_URL')) |
|
22 |
{ |
|
23 |
require($config_file); |
|
24 |
} |
|
25 |
} |
|
26 |
if(!class_exists('admin', false)){ include(WB_PATH.'/framework/class.admin.php'); } |
|
22 | 27 |
|
23 |
require_once(WB_PATH.'/framework/class.admin.php'); |
|
24 |
// require_once(WB_PATH.'/include/pclzip/pclzip.lib.php'); // Required to unzip file. |
|
28 |
$modulePath = dirname(__FILE__); |
|
29 |
|
|
30 |
//include_once('resize_img.php'); |
|
31 |
include_once($modulePath.'/parameters.php'); |
|
32 |
|
|
25 | 33 |
// suppress to print the header, so no new FTAN will be set |
26 | 34 |
$admin = new admin('Media', 'media_upload', false); |
27 | 35 |
|
... | ... | |
57 | 65 |
// Find out whether we should replace files or give an error |
58 | 66 |
$overwrite = ($admin->get_post('overwrite') != '') ? true : false; |
59 | 67 |
|
68 |
$file_extension_string = ''; |
|
60 | 69 |
// Get list of file types to which we're supposed to append 'txt' |
61 |
$get_result=$database->query("SELECT value FROM ".TABLE_PREFIX."settings WHERE name='rename_files_on_upload' LIMIT 1"); |
|
62 |
$file_extension_string=''; |
|
63 |
if ($get_result->numRows()>0) { |
|
64 |
$fetch_result=$get_result->fetchRow(); |
|
65 |
$file_extension_string=$fetch_result['value']; |
|
70 |
$sql = 'SELECT ´value´ FROM ´'.TABLE_PREFIX. 'settings´ '. |
|
71 |
'WHERE ´name´=\'rename_files_on_upload\''; |
|
72 |
|
|
73 |
if($oRes = $database->query($sql)) { |
|
74 |
$aResult = $oRes->fetchRow(MYSQL_ASSOC); |
|
75 |
$file_extension_string = $aResult['value']; |
|
66 | 76 |
} |
67 | 77 |
|
68 | 78 |
$file_extensions=explode(",",$file_extension_string); |
... | ... | |
104 | 114 |
} |
105 | 115 |
} |
106 | 116 |
|
117 |
|
|
107 | 118 |
if(file_exists($relative.$filename)) { |
108 |
if ($pathsettings[$resizepath]['width'] || $pathsettings[$resizepath]['height'] ) { |
|
109 |
$rimg=new RESIZEIMAGE($relative.$filename); |
|
110 |
$rimg->resize_limitwh($pathsettings[$resizepath]['width'],$pathsettings[$resizepath]['height'],$relative.$filename); |
|
111 |
$rimg->close(); |
|
119 |
|
|
120 |
$ImgWidth = isset($pathsettings[$resizepath]['width']) ? intval($pathsettings[$resizepath]['width']) : null; |
|
121 |
$ImgHeigth = isset($pathsettings[$resizepath]['height']) ? intval($pathsettings[$resizepath]['height']) : null; |
|
122 |
|
|
123 |
if ($ImgWidth!=null || $ImgHeigth!=null ) { |
|
124 |
if(!class_exists('PhpThumbFactory', false)){ include($modulePath.'/inc/ThumbLib.inc.php'); } |
|
125 |
$oImage = PhpThumbFactory::create($relative.$filename); |
|
126 |
$aOldSize = $oImage->getCurrentDimensions(); |
|
127 |
$ImgPercent = 50; |
|
128 |
|
|
129 |
if ($ImgWidth!=null && $ImgHeigth==null ) { |
|
130 |
$ImgPercent = $ImgWidth*100/$aOldSize['width']; |
|
131 |
$ImgHeigth = $ImgWidth; |
|
132 |
} elseif( $ImgWidth==null && $ImgHeigth!=null ) { |
|
133 |
$ImgPercent = $ImgHeigth*100/$aOldSize['height']; |
|
134 |
$ImgWidth = $ImgHeigth; |
|
135 |
} else { |
|
136 |
$ImgPercent = $ImgWidth*100/$aOldSize['width']; |
|
137 |
} |
|
138 |
$oImage->resize($ImgWidth,$ImgHeigth)->save($relative.$filename); |
|
139 |
// $oImage->resizePercent($ImgPercent)->save($relative.$filename); |
|
140 |
// $oImage->adaptiveResize($ImgWidth,$ImgHeigth)->save($relative.$filename); |
|
141 |
// $oImage->save($relative.$filename); |
|
112 | 142 |
} |
143 |
|
|
113 | 144 |
} |
114 | 145 |
|
115 | 146 |
// store file name of first file for possible unzip action |
Also available in: Unified diff
- removed obselete resize_img.php