Hello I’m somewhat stuck with a feature of my website I want to upgrade from Kirby 2 to v3.
Intro
I’m a photographer and I have a built in client release form inside any of my clients gallery. The idea is, that I make an selection of images I want to release to the public and the client can login and edit this selection and finally fill out a release form, which will generate a pdf contract. This is where I’m stuck.
The form is posting to the corresponding controller, which handles form submission an loads up the HTML2PDF library (https://html2pdf.fr) for generating the pdf. The pdf contains the form inputs as well as the selected images listed in columns.
How I did it in v2
Since pasting the thumb url as image source inside the pdf generation seemed to be way to slow (talking about 60 to 200 pictures), I switched to using the dataUri function in Kirby 2 which worked perfectly.
thumb($selectedimage, array('width' => 300,'height' => 300, 'crop' => false, 'quality' => 40))->dataUri()
This has been deprecated in v3 so I used the Toolkits pendants F::uri()
(or F::base64()
) with the root path of the thumbnail. Unfortunately, the thumb is not yet created when trying to encode it to base64, returning an empty string.
What I’m trying out now
Thumb settings
$thumb = $selectedimage->thumb(['width' => 200,'height' => 200, 'crop' => false, 'quality' => 40]);
$thumb->url()
does work when opening it with the browser or importing it in pdf (but is very slow)
dump(file_get_contents($thumb->root()));
Returning error file not found
dump(F::uri($thumb->root()));
returning empty base64 string
Is there a way I can get the source of the thumbnail in base64 encoding or force-generate those thumbnails?
Thanks in advance!
Justus