In Koha 17.11, I am trying to upload a .jpg image to a bibliographic record (as a local cover image). After uploading, then clicking "Process Images", I get the following error: "Cannot process file as an image. Cannot process file as an image. Please ensure you only upload GIF, JPEG, PNG, or XPM images." I've tried to upload the file as a .jpg, .png, and .gif. The error persists. I've also tried to upload a different .jpg file. The error still persists.
Checking the intranet error log, it reads: "[Fri Dec 29 13:52:20.972923 2017] [cgi:error] [pid 5805] [client 142.116.112.216:50322] AH01215: [Fri Dec 29 13:52:20 2017] upload-cover-image.pl: Use of uninitialized value $domain in regexp compilation at /usr/share/koha/lib/C4/Auth.pm line 1090.: /usr/share/koha/intranet/cgi-bin/tools/upload-cover-image.pl, referer: http://library.craigbutosi.ca:8080/cgi-bin/koha/tools/upload-cover-image.pl"
The relevant code of the warning is: 1084 my $branches = { map { $_->branchcode => $_->unblessed } Koha::Libraries->search }; 1085 if ( $type ne 'opac' and C4::Context->boolean_preference('AutoLocation') ) { 1086 1087 # we have to check they are coming from the right ip range 1088 my $domain = $branches->{$branchcode}->{'branchip'}; 1089 $domain =~ s|\.\*||g; 1090 if ( $ip !~ /^$domain/ ) { 1091 $loggedin = 0; 1092 $cookie = $query->cookie( 1093 -name => 'CGISESSID', 1094 -value => '', 1095 -HttpOnly => 1 1096 ); 1097 $info{'wrongip'} = 1; 1098 } 1099 } It says that you have AutoLocation turned on and the "branchip" field of the branches table does not match your IP. It also says that you are using a non superlibrarian account. Could you confirm this? If the IP does not match, it is expected that you are rejected, but in that case it should be the same behaviour with other scripts.
(In reply to Jonathan Druart from comment #2) > The relevant code of the warning is: > > 1084 my $branches = { map { $_->branchcode => > $_->unblessed } Koha::Libraries->search }; > 1085 if ( $type ne 'opac' and > C4::Context->boolean_preference('AutoLocation') ) { > 1086 > 1087 # we have to check they are coming from the > right ip range > 1088 my $domain = > $branches->{$branchcode}->{'branchip'}; > 1089 $domain =~ s|\.\*||g; > 1090 if ( $ip !~ /^$domain/ ) { > 1091 $loggedin = 0; > 1092 $cookie = $query->cookie( > 1093 -name => 'CGISESSID', > 1094 -value => '', > 1095 -HttpOnly => 1 > 1096 ); > 1097 $info{'wrongip'} = 1; > 1098 } > 1099 } > > > It says that you have AutoLocation turned on and the "branchip" field of the > branches table does not match your IP. It also says that you are using a non > superlibrarian account. > > Could you confirm this? > If the IP does not match, it is expected that you are rejected, but in that > case it should be the same behaviour with other scripts. Hi Jonathan, Thanks for this. I am indeed using a superlibrarian account, so I'm surprised that it is reporting otherwise. I have only one patron in the system, me, and it was initially setup as superlibrarian staff. You are correct about Autolocation, it was turned on. But I have since disabled it. The IP address field in the bramches table is blank. Unfortunately, after turning off Autolocation, restarting Koha, and restarting memcache, the error still persists.
(In reply to Craig from comment #3) > Unfortunately, after turning off Autolocation, restarting Koha, and > restarting memcache, the error still persists. Do you still have the warning in the logs? What is the exact version of Koha you are using? Did you try on a sandbox?
(In reply to Jonathan Druart from comment #4) > (In reply to Craig from comment #3) > > Unfortunately, after turning off Autolocation, restarting Koha, and > > restarting memcache, the error still persists. > > Do you still have the warning in the logs? > What is the exact version of Koha you are using? > Did you try on a sandbox? Hi Jonathan, I'm running 17.11.01.000. No new intranet error logs, no new opac error logs relevant to cover image upload. I don't have a sandbox to test, unfortunately. I created a new super librarian patron, logged in as that user, and tried to upload. The problem persists. I also entered my public IP address into the branches table, tried to upload, and still nothing.
Can you confirm you do not have any warnings related to upload files on the about page (tab "system information")?
(In reply to Jonathan Druart from comment #6) > Can you confirm you do not have any warnings related to upload files on the > about page (tab "system information")? Confirmed. There are no warnings posted here.
Still having trouble with this. I've successfully uploaded patron images, files to patron records, and files using the "upload file" option in Administration. Checked log files again and there's nothing there from what I can see. Upgrading to the latest version of Koha (17.11.03) has no effect. Could it be an Apache or MariaDB setting?
(In reply to Craig from comment #8) > Still having trouble with this. I've successfully uploaded patron images, > files to patron records, and files using the "upload file" option in > Administration. > > Checked log files again and there's nothing there from what I can see. > > Upgrading to the latest version of Koha (17.11.03) has no effect. Could it > be an Apache or MariaDB setting? No problem in uploading a cover image file on current master here.
I got this problem on Debian Stretch with version 17.11.03-1. Solution was to disable Systemd's Apache2's PrivateTmp flag. /lib/systemd/system/apache2.service -------------- [Unit] Description=The Apache HTTP Server After=network.target remote-fs.target nss-lookup.target [Service] Type=forking Environment=APACHE_STARTED_BY_SYSTEMD=true ExecStart=/usr/sbin/apachectl start ExecStop=/usr/sbin/apachectl stop ExecReload=/usr/sbin/apachectl graceful PrivateTmp=false Restart=on-abort [Install] WantedBy=multi-user.target ----------- systemctl daemon-reload systemctl restart apache2
(In reply to Jef Bucas from comment #10) > I got this problem on Debian Stretch with version 17.11.03-1. > > Solution was to disable Systemd's Apache2's PrivateTmp flag. > > /lib/systemd/system/apache2.service > -------------- > [Unit] > Description=The Apache HTTP Server > After=network.target remote-fs.target nss-lookup.target > > [Service] > Type=forking > Environment=APACHE_STARTED_BY_SYSTEMD=true > ExecStart=/usr/sbin/apachectl start > ExecStop=/usr/sbin/apachectl stop > ExecReload=/usr/sbin/apachectl graceful > PrivateTmp=false > Restart=on-abort > > [Install] > WantedBy=multi-user.target > ----------- > > systemctl daemon-reload > systemctl restart apache2 Hi Jef, Thanks for this. I will try and disable later tonight and report back. To the community, just out of curiosity, would this problem in any way be related to setting a template cache directory, as specified here: https://wiki.koha-community.org/wiki/Performance? Many thanks!
(In reply to Craig from comment #11) > (In reply to Jef Bucas from comment #10) > > I got this problem on Debian Stretch with version 17.11.03-1. > > > > Solution was to disable Systemd's Apache2's PrivateTmp flag. > > > > /lib/systemd/system/apache2.service > > -------------- > > [Unit] > > Description=The Apache HTTP Server > > After=network.target remote-fs.target nss-lookup.target > > > > [Service] > > Type=forking > > Environment=APACHE_STARTED_BY_SYSTEMD=true > > ExecStart=/usr/sbin/apachectl start > > ExecStop=/usr/sbin/apachectl stop > > ExecReload=/usr/sbin/apachectl graceful > > PrivateTmp=false > > Restart=on-abort > > > > [Install] > > WantedBy=multi-user.target > > ----------- > > > > systemctl daemon-reload > > systemctl restart apache2 > > Hi Jef, > > Thanks for this. I will try and disable later tonight and report back. To > the community, just out of curiosity, would this problem in any way be > related to setting a template cache directory, as specified here: > https://wiki.koha-community.org/wiki/Performance? > > Many thanks! Hi everyone, Can confirm Jef's fix above. I am now able to successfully upload a local cover image. Jef, thanks again!
*** This bug has been marked as a duplicate of bug 20428 ***