nextcloud / whiteboard

Create & collaborate on an infinite canvas!
https://apps.nextcloud.com/apps/whiteboard
GNU Affero General Public License v3.0
62 stars 8 forks source link

File previews #22

Open juliusknorr opened 5 months ago

juliusknorr commented 5 months ago

It would be great to generate some previews, certainly nothing for the first iteration

juliusknorr commented 2 weeks ago

@hweihwang Could you check what options we would have to generate a preview image of a whiteboard? We would need to implement a PHP provider for the preview files but could issue a request to the whiteboard server to handle the whiteboard to image conversion in node.js. Maybe you can evaluate how this could be implemented and give an effort estimation

hweihwang commented 1 week ago

Thanks @juliusknorr

I mainly think of 2 ways:

1. Client-Side Rendering: The user's browser would generate the preview each time they make a change. We can use Excalidraw's exportToBlob API to create an image and save it directly within the file. PHP can then easily access this image for previews.

2. Server-Side Rendering: Headless browser (Puppeteer) would generate the preview, either on PHP or Node side but preferred on the Node.js for simple and native. The preview can be saved directly to the file upon changes (within Node.js) or generated on demand.