captive: Allow uploading JPEG images, too

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
This commit is contained in:
Michael Tremer
2017-04-28 14:29:15 +01:00
parent 8802d70a28
commit b7a126d9c8

View File

@@ -59,15 +59,15 @@ unless (-e $settingsfile) { system("touch $settingsfile"); }
&Header::showhttpheaders();
#actions
if ($cgiparams{'ACTION'} eq "$Lang::tr{'save'}"){
if ($cgiparams{'ACTION'} eq $Lang::tr{'save'}) {
my $file = $cgiparams{'logo'};
if ($file){
#Check if extension is png
if ($file) {
# Check if the file extension is PNG/JPEG
chomp $file;
my ($name, $path, $ext) = fileparse($file, qr/\.[^.]*$/);
if ($ext ne ".png"){
$errormessage=$Lang::tr{'Captive wrong ext'};
if ($ext ne ".png" && $ext ne ".jpg" && $ext ne ".jpeg") {
$errormessage = $Lang::tr{'Captive wrong ext'};
}
}
@@ -623,20 +623,6 @@ sub validremark
return 1;
}
sub pngsize {
my $Buffer = shift;
my ($width,$height) = ( undef, undef );
if ($Buffer =~ /IHDR(.{8})/) {
my $PNG = $1;
($width,$height) = unpack( "NN", $PNG );
} else {
$width="invalid";
$height= "invalid";
};
return ($width,$height);
}
sub error{
#if an errormessage exits, show a box with errormessage
if ($errormessage) {