BUGFIX : encoding problem & security problem
[koha_fer] / tools / picture-upload.pl
index d961492..695adb3 100755 (executable)
@@ -37,7 +37,7 @@ my ($template, $loggedinuser, $cookie)
                                        query => $input,
                                        type => "intranet",
                                        authnotrequired => 0,
-                                       flagsrequired => {management => 1, tools => 1},
+                                       flagsrequired => {management => 1, tools => 'batch_upload_patron_images'},
                                        debug => 0,
                                        });
 
@@ -243,6 +243,11 @@ sub handle_file {
                 $imgfile = $img[0];
                 warn "$filename is " . length($imgfile) . " bytes after resizing.";
                 undef $image;    # This object can get big...
+            } else {
+                my @img = $image->ImageToBlob();
+                $imgfile = $img[0];
+                $debug and warn "$filename is " . length($imgfile) . " bytes.";
+                undef $image;
             }
             $debug and warn "Image is of mimetype $mimetype";
             my $dberror = PutPatronImage($cardnumber,$mimetype, $imgfile) if $mimetype;