Some improvements and fixes for webgui
This commit is contained in:
+14
-1
@@ -15,6 +15,7 @@ doctype icons
|
||||
*/
|
||||
|
||||
require 'globals.inc';
|
||||
require 'lib/db.inc';
|
||||
require 'lib/gpc.inc';
|
||||
require 'lib/fileutils.inc';
|
||||
|
||||
@@ -89,7 +90,19 @@ switch ($submit = form_get_action()) {
|
||||
$g_warning->Add(sprintf(_("Mimetype mismatch: '%s'."), $file_type));
|
||||
}
|
||||
|
||||
// TODO for images check maximum size and scale down if needed
|
||||
// for images check maximum size and scale down if needed
|
||||
if (isset($_POST['noscale'])) {
|
||||
$g_message->Add(_('Image has not been scaled down'));
|
||||
} else {
|
||||
// scale down if dimensions exceed limits
|
||||
$img_maxx= $pdo->query("SELECT valint FROM settings WHERE userid=0 AND sno=20")->fetchColumn();
|
||||
$img_maxy= $pdo->query("SELECT valint FROM settings WHERE userid=0 AND sno=21")->fetchColumn();
|
||||
[$width, $height] = getimagesize($file_tmp);
|
||||
$factor = min($img_maxx / $width, $img_maxy / $height);
|
||||
if ($factor < 1) {
|
||||
image_scale($file_tmp, $file_mimetype, $width, $height, $factor);
|
||||
}
|
||||
}
|
||||
|
||||
// ok let's go
|
||||
$file_hash = md5_file($file_tmp);
|
||||
|
||||
Reference in New Issue
Block a user