Open andybak opened 1 month ago
I've added support to the viewer component. Here's example usage:
function updateThumbnail() { let dataURL = viewer.captureThumbnail(512, 384); let imageBlob = viewer.dataURLtoBlob(dataURL); let img = document.getElementsByClassName('img-preview')[0]; img.src = dataURL; let formData = new FormData(); formData.append('file', imageBlob, 'thumbnail.png'); fetch(window.location + '/updateThumbnail', { method: 'POST', body: formData }) .then(response => response.json()) .then(data => { console.log('Upload successful:', data); }) .catch((error) => { console.error('Error uploading image:', error); }); }
This code should update the thumbnail preview on the page and also POST a blob to a (non-existent) endpoint.
Admins also need a way to do this for assets they don't own. Maybe the "edit" page can accept a superuser override?
I've added support to the viewer component. Here's example usage:
This code should update the thumbnail preview on the page and also POST a blob to a (non-existent) endpoint.