[Bug 35520] New: Add a script to export images from the db
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=35520 Bug ID: 35520 Summary: Add a script to export images from the db Change sponsored?: --- Product: Koha Version: master Hardware: All OS: All Status: NEW Severity: enhancement Priority: P5 - low Component: Command-line Utilities Assignee: koha-bugs@lists.koha-community.org Reporter: magnus@libriotech.no QA Contact: testopia@bugs.koha-community.org CC: robin@catalyst.net.nz Could be useful both for cover_images and patronimage. -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=35520 --- Comment #1 from Magnus Enger <magnus@libriotech.no> --- Or is there a standard way to do this that makes a special script unnecessary? I imagine we want to put things like biblionumber and borrowernumber in the filename, which might make a generic solution har to use. -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=35520 --- Comment #2 from Magnus Enger <magnus@libriotech.no> --- Here's a very basic POC, just for cover images. Feel free to build on it if you can beat me to it! :-) use Koha::CoverImages; use File::Slurper qw( write_binary ); use Modern::Perl; my $outputdir = '.'; my $covers = Koha::CoverImages->search(); while ( my $cover = $covers->next ) { my $biblionumber = $cover->biblionumber; my $imagenumber = $cover->imagenumber; my $itemnumber = $cover->itemnumber; # Can be NULL my $filename = "$outputdir/biblionumber_$biblionumber" . "_imagenumber_$imagenumber" . "_full.png"; write_binary( $filename, $cover->imagefile ); say "Wrote $filename"; my $thumbnail = "$outputdir/biblionumber_$biblionumber" . "_imagenumber_$imagenumber" . "_thumb.png"; write_binary( $thumbnail, $cover->thumbnail ); say "Wrote $thumbnail"; } -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
participants (1)
-
bugzilla-daemon@bugs.koha-community.org