Bug 31624 - REST API: Add endpoint for generated covers
Summary: REST API: Add endpoint for generated covers
Status: ASSIGNED
Alias: None
Product: Koha
Classification: Unclassified
Component: REST API (show other bugs)
Version: Main
Hardware: All All
: P5 - low new feature
Assignee: Paul Derscheid
QA Contact:
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-09-26 13:34 UTC by Paul Derscheid
Modified: 2022-12-19 21:41 UTC (History)
1 user (show)

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


Attachments
Bug 31624: REST API: Add endpoint for generated covers (16.90 KB, patch)
2022-12-19 21:37 UTC, Paul Derscheid
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Paul Derscheid 2022-09-26 13:34:01 UTC
This endpoint returns base64 encoded images that are generated based on url parameters you can supply (currently title, author). It's part of my attempt to get the current shelfbrowser replaced (https://wiki.koha-community.org/wiki/User:Paulderscheid ; This will be updated shortly, but I'm still on vacation).
Comment 1 Paul Derscheid 2022-12-19 21:37:03 UTC
Created attachment 144726 [details] [review]
Bug 31624: REST API: Add endpoint for generated covers

This commit contains the main changes for the endpoint and the controller for the image generation.
To test this, if you don't have a very elaborate setup:
1. Apply the patch
2. Request the endpoint, for example using: http://localhost:8080/api/v1/public/biblios/1/default_cover
3. Now you could use this JS in your console to get an unescaped version of the JSON response
const response = await fetch('http://localhost:8080/api/v1/public/biblios/1/default_cover');
const result = await response.json();
console.log(result);
4. Copy the response and check whether it actually is a valid base64 encoded image. For example using this tool: https://base64.guru/converter/decode/file
5. Give me your thoughts on this patch

I'm still in the process of using unit tests and hunting bugs, so it's now ready for a sign-off but I thought I'd already show it to whoever is interested.
Comment 2 Paul Derscheid 2022-12-19 21:37:58 UTC
The preliminary test plan assumes ktd, btw.
Comment 3 Paul Derscheid 2022-12-19 21:41:41 UTC
I made some typos. The patch is not ready for a sign-off (not 'now' ready).
And of course I'm in the process of writing unit tests, not using them. ﷐[U+1F62C]﷑
See #c1 for reference.