Bug 17650 - Create the option to save local cover images outside the database
Summary: Create the option to save local cover images outside the database
Status: In Discussion
Alias: None
Product: Koha
Classification: Unclassified
Component: Cataloging (show other bugs)
Version: master
Hardware: All All
: P5 - low new feature with 6 votes (vote)
Assignee: Rodrigo Santellan
QA Contact: Testopia
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-11-17 12:25 UTC by Rodrigo Santellan
Modified: 2023-08-05 00:29 UTC (History)
12 users (show)

See Also:
Change sponsored?: ---
Patch complexity: ---
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:


Attachments
Search a cover image. (22.93 KB, image/png)
2016-11-17 12:54 UTC, Rodrigo Santellan
Details
Bug 17650 - Create the option to save the cover with the uploaded files. (15.79 KB, patch)
2016-11-17 13:53 UTC, Rodrigo Santellan
Details | Diff | Splinter Review
Bug 17650 - Create the option to save the cover with the uploaded files. (16.17 KB, patch)
2018-10-17 18:05 UTC, Mark Tompsett
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Rodrigo Santellan 2016-11-17 12:25:18 UTC
Create the option to save the uploaded cover files with the rest of the files. Removing them from saving on the DB and save them on the koha uploads directory. Giving the implementation of creating cache miniatures for using them.
There must be an option to enable this feature or not for backward compability.
Comment 1 Marcel de Rooy 2016-11-17 12:47:10 UTC
Do you plan to add records too in uploaded_files table ?
Comment 2 Rodrigo Santellan 2016-11-17 12:49:10 UTC
In the current flow the files are added on the uploaded_files tables. The only difference is that they are with permanent = 0 instead of permanent = 1
Comment 3 Marcel de Rooy 2016-11-17 12:52:27 UTC
(In reply to Rodrigo Santellan from comment #2)
> In the current flow the files are added on the uploaded_files tables. The
> only difference is that they are with permanent = 0 instead of permanent = 1

The permanent=0 files are stored in another file location (/tmp) and are meant to be removed after some defined number of days (work in progress). Just need to add a cron job for that.
Comment 4 Rodrigo Santellan 2016-11-17 12:54:51 UTC
Created attachment 57596 [details]
Search a cover image.

Final look for re utilizing cover images.
Comment 5 Rodrigo Santellan 2016-11-17 12:56:02 UTC
I added an image to what I want to achieve. The main goal is to re utilize the same image for different biblios without adding them multiple times.
Comment 6 Rodrigo Santellan 2016-11-17 13:53:02 UTC
Created attachment 57598 [details] [review]
Bug 17650 - Create the option to save the cover with the uploaded files.

Create the option to save the uploaded cover files with the rest of the files. Removing them from saving on the DB and save them on the koha uploads directory.
Giving the implementation of creating cache miniatures for using them.

Added an option on System Preferences to enable this new feature: SaveCoverOnDisk
Comment 7 Rodrigo Santellan 2016-11-17 13:53:57 UTC
The Images.t should pass as usual.
Comment 8 Marcel de Rooy 2016-11-17 14:07:36 UTC
tools/upload-file.pl
Remove Dumper and warn please
Also from tools/upload-cover-image.pl and file-search

INSERT INTO biblioimages (biblionumber, mimetype, imagefile, thumbnail, uploadedfileid)
The mix of upload and biblioimages like this does not look good to me.
Isn't this just a new type of cover images to be triggered by a new pref somewhere else?
Discussion ??

In _retrieve_thumbs_images you seem to copy/save the file somewhere else outside the uploads dir ?

tools/file-search.pl
Converted to new plugin style (Bug 13437) ???
$debug or $debug = $input->param('debug') || 0;  ???
use warnings;
no warnings 'redefine'; # otherwise loading up multiple plugins fills the log with subroutine redefine warnings
Hmm

Did you test this under Plack too?
Comment 9 Rodrigo Santellan 2016-11-17 14:34:51 UTC
Yes I tested under plack and is working.

I save on /tmp the thumbnail of the image to not process it multiple times.
Comment 10 Eric 2017-03-24 18:04:55 UTC
Patch didn't apply in the sandbox. 

Some problems occurred applying patches from bug 17650:
<h1>Something went wrong !</h1>Applying: Bug 17650 - Create the option to save the cover with the uploaded files.
.git/rebase-apply/patch:69: trailing whitespace.
            ->png(),  );    
.git/rebase-apply/patch:73: trailing whitespace.
    
.git/rebase-apply/patch:97: trailing whitespace.
            ->{'imagefile'} = ;  
.git/rebase-apply/patch:157: trailing whitespace.
ALTER TABLE  
.git/rebase-apply/patch:159: trailing whitespace.
Comment 11 Mark Tompsett 2018-10-17 18:05:02 UTC
Created attachment 80745 [details] [review]
Bug 17650 - Create the option to save the cover with the uploaded files.

Create the option to save the uploaded cover files with the rest of the files. Removing them from saving on the DB and save them on the koha uploads directory.
Giving the implementation of creating cache miniatures for using them.

Added an option on System Preferences to enable this new feature: SaveCoverOnDisk
Comment 12 Mark Tompsett 2018-10-17 18:05:41 UTC
Hopefully rescued correctly. The move of javascript to the bottom broke the application.
Comment 13 Cori Lynn Arnold 2018-10-22 20:05:50 UTC
Can I get some test steps for this?
Comment 14 Holly 2019-09-12 14:41:38 UTC
Hi,
I was just wondering if someone could provide some test steps for this please?
Comment 15 Owen Leonard 2019-09-12 21:15:55 UTC
The patch applies fine (wow), and I have one suggestion right off the bat:

The system preference should be worded and structured in a way that it is a sentence. Instead of:

[Yes/No]  Save the covers on the the hard disk instead of the database. 

It should be something like:

Save cover images on the [hard disk/database].

Would it be clearer to say "server file system" instead of "hard disk?" Could people be confused that it referred to their own hard disk?

I ran into a problem, though, as soon as I navigated to the 'Upload local cover image' page:

Can't locate Koha/Upload.pm in @INC
Comment 16 Blou 2022-07-08 12:42:10 UTC
This functionality would interest us.  We're trying to reduce the imprint of biblioimages on our database size.

Is there a reason the QA could already forewarn us about that this idea (moving biblioimages outside the DB) would gain no traction?

Not sure if the current implementation is the right way, but we'd add a script to move the current biblioimages out, as well.
Comment 17 Katrin Fischer 2022-07-15 15:22:46 UTC
> Is there a reason the QA could already forewarn us about that this idea
> (moving biblioimages outside the DB) would gain no traction?

I think it would make sense to have this at least as an option. Not sure if or how existing installations could be switched over. 

Adding some more CC.