Some improvements and fixes for webgui

This commit is contained in:
2026-09-12 11:05:09 +02:00
parent 82dea5800d
commit 4bc8dd8280
15 changed files with 206 additions and 36 deletions
+14 -1
View File
@@ -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);